Need a worker thread wait timer..
-
I have a worker thread that needs to wait a certain amount of miliseconds before resuming.. I would just got the for(i=0; i<10000000000; i++) route, but i'm afaid it will eat up the CPU. I'm trying to stay out of a loop but stay in the worker thread. I need my main thread to be very alert and time accurate while this worker thread is waiting. I've looked at all the timer functions.. can't seem to find the one to do the trick.. any ideas.. ? Workthread() { //do some processing //wait //do more processing //return }
-
I have a worker thread that needs to wait a certain amount of miliseconds before resuming.. I would just got the for(i=0; i<10000000000; i++) route, but i'm afaid it will eat up the CPU. I'm trying to stay out of a loop but stay in the worker thread. I need my main thread to be very alert and time accurate while this worker thread is waiting. I've looked at all the timer functions.. can't seem to find the one to do the trick.. any ideas.. ? Workthread() { //do some processing //wait //do more processing //return }
-
I have a worker thread that needs to wait a certain amount of miliseconds before resuming.. I would just got the for(i=0; i<10000000000; i++) route, but i'm afaid it will eat up the CPU. I'm trying to stay out of a loop but stay in the worker thread. I need my main thread to be very alert and time accurate while this worker thread is waiting. I've looked at all the timer functions.. can't seem to find the one to do the trick.. any ideas.. ? Workthread() { //do some processing //wait //do more processing //return }
On Windows, try Sleep(milliseconds) Eats NO CPU :)
-
On Windows, try Sleep(milliseconds) Eats NO CPU :)
-
;P
-
;P
duh... didn't have the time.h header in... my bad.. thanks guys
-
duh... didn't have the time.h header in... my bad.. thanks guys
aquawicket wrote:
duh... didn't have the time.h header in... my bad.. thanks guys
try more efficient WaitForSingleObject with retrun value WAIT_TIMEOUT
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief And You