M
mike79
hi all,
i am implementing a program using threads. I spawn a separate thread
to execute a task every say 10 seconds. How I achieve this 10 second
delay is by using a for/while loop, and incrementing the counter to a
particular value relevant to 10 seconds. As follows:
timerThread()
{
for (i = 0; i < 100000000; i++);
// Next, do the task
}
As this is very resource/processor consuming (spending alot of time
doing nothing), I was wondering if C provided any functions which are
more efficient than this method.
All help or suggestions are welcome, thank you for your help!
mike79
i am implementing a program using threads. I spawn a separate thread
to execute a task every say 10 seconds. How I achieve this 10 second
delay is by using a for/while loop, and incrementing the counter to a
particular value relevant to 10 seconds. As follows:
timerThread()
{
for (i = 0; i < 100000000; i++);
// Next, do the task
}
As this is very resource/processor consuming (spending alot of time
doing nothing), I was wondering if C provided any functions which are
more efficient than this method.
All help or suggestions are welcome, thank you for your help!
mike79