Opened 8 years ago
Last modified 7 years ago
#11174 closed Bugs
boost::condition_variable::timed_wait with predicate unexpectedly wakes up while should wait infinite — at Version 1
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Boost 1.60.0 | Component: | thread |
Version: | Boost 1.57.0 | Severity: | Regression |
Keywords: | Cc: |
Description (last modified by )
This is a follow on from the closed bug #9708. boost::condition_variable::timed_wait(..., boost::posix_time::time_duration(boost::posix_time::pos_infin), predicate_type pred) always immediately returns false. The referenced bug suggests this worked in 1.44.
A fix for the non-predicate overload was merged for 1.56 but this wasn't applied for the other overloads of timed_wait.
The current workaround we have is:
bool timeoutReached = false; if(timeToWait.is_pos_infinity()) { waitHandle.wait(lock, boost::bind(&ObjectPool::IsResourceReady, this, boost::ref(waitHandle))); } else { // timed_wait returns false if the timeout was reached timeoutReached = !waitHandle.timed_wait(lock, timeToWait, boost::bind(&ObjectPool::IsResourceReady, this, boost::ref(waitHandle))); } if (timeoutReached) { // handle timeout }
Change History (1)
comment:1 by , 8 years ago
Description: | modified (diff) |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Note:
See TracTickets
for help on using tickets.