Subject: [Boost-bugs] [Boost C++ Libraries] #12728: BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC incompatible with timed_wait
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-01-05 10:27:27
#12728: BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC incompatible with timed_wait
------------------------------------+----------------------
Reporter: Roger Karis <rkaris@â¦> | Owner: anthonyw
Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
Version: Boost 1.63.0 | Severity: Problem
Keywords: |
------------------------------------+----------------------
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.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12728> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC