Opened 6 years ago
Closed 6 years ago
#12728 closed Bugs (wontfix)
BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC incompatible with timed_wait
Reported by: | Owned by: | Anthony Williams | |
---|---|---|---|
Milestone: | To Be Determined | Component: | thread |
Version: | Boost 1.63.0 | Severity: | Problem |
Keywords: | Cc: |
Description
If BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC is defined, timed_wait functions wait much longer than expected.
To reproduce:
#define BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC #include <boost/date_time.hpp> #include <boost/thread.hpp> int main(int argc, char** argv) { boost::condition_variable c; boost::mutex m; boost::unique_lock<boost::mutex> l(m); boost::system_time const timeout = boost::get_system_time() + boost::posix_time::milliseconds(500); c.timed_wait(l, timeout); // Waits for a long time c.timed_wait(l, boost::posix_time::milliseconds(500)); // Waits for an equally long time return 0; }
These functions (along with other timed_ functions) are deprecated but are currently still allowed to be used in conjunction with BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC.
Note:
See TracTickets
for help on using tickets.
The timed_wait interface is deprecated. Please, let me know if there are some issues with the chrono interface.