I'm using boost::threads, but not any of the timed wait stuff. I run my viewer in its own thread.
It is my understanding that for a timed wait, you do need to manually track how much time has actually elapsed and restart the wait if necessary. Cory J.P. Delport wrote: > Hi all, > > I'm using OpenThreads in a cross-platform application and wanted to > use the Condition implementation, specifically the wait(timeout) > version. However, the pthread docs suggest that pthread_cond_timedwait > (that is used by OT) can return without explicitly being signalled > (so-called spurious wakeups [1]). Now if I used pthreads directly I > can just put the wait in a while loop checking my condition, because > pthread_cond_timedwait takes an absolute time as a parameter and not a > relative time as OT::Condition does. > > With the current OT::Condition there is no way to easily restart the > timed wait (one will have to keep track of time oneself and OT does > not have functions for it). > > I've searched for places in OSG where the timed wait is used and it is > not used much. It is used in block(timeout) too, but that is also not > used much in OSG. However, in the new ffmpeg plugin there is also this > comment before using the timed wait: > > ---8<--- > // We don't wait in a loop to avoid an infinite loop (as the ms > timeout would not be decremented). > // This means that timedPop() could return with (is_empty = true) > before the timeout has been hit. > ---8<--- > > Does anyone have more information on how to handle this issue? Should > I just write my code to cope with this limitation? Has anyone used > boost threads (and associated sync utils) with OSG? > > rgds > jp > > > [1] see the pthread docs or > http://en.wikipedia.org/wiki/Spurious_wakeup > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

