Monday, 2 September 2013

Is there a better way instead of while(1) in c for waiting?

Is there a better way instead of while(1) in c for waiting?

Is there a better way instead of while(1) in c? My concern is to wait in
the code. and move further if work is done. Like, in some thread
while (cond = 0) {
// wait
}
From some other thread, cond variable made 1, then thread can move
further.. I want to remove this infinite while condition. Using semaphore
signal is taking time while posting and receiving signal. Sample program i
asked it in my previous question: Is semaphore usage in this solution is
correct?
Any kind of help will be appreciated. Thanks in advance.

No comments:

Post a Comment