wait for a condition to be satisfied



Hi there,

I'm looking for a function which returns if a certain condition is
satisfied. I'm now using:

/* now, we need to pause until scene detection is done */
while (scene_detection_reply == 1)
	usleep(100000);

but this is ugly (imho, that is ;-) ). Is there something like
waitfor(scenedetection != 1) in Gtk, glib or anything?

Secondly, sleep() (and usleep()) are not thread-safe, are they? is there
anything thread-safe as a replacement for sleep()? (I heard about g_sleep
but "grep -r g_sleep /usr/include/*" gives no results)

Regards and thanks in advance,

Ronald Bultje





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]