I would like to create a new thread that remains in a loop. Something like this:
void Clock() {
double Time = 0;
while (1) {
usleep(1000);
Time = (Time+0.1);
}
return;
}
I would then like my other existing threads to be able to access the latest clock value and use it. How do I declare the "Time" variable so that it can be accessed by all threads and how would I alter the code above to accommodate that? And also what would i need to do to access it?