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
--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their support.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org