Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9708: regression: boost::condition_variable::timed_wait unexpectedly wakes up while should wait infinite
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-02-28 03:59:38
#9708: regression: boost::condition_variable::timed_wait unexpectedly wakes up
while should wait infinite
-------------------------------+------------------------
Reporter: nikolay@⦠| Owner: viboes
Type: Bugs | Status: assigned
Milestone: To Be Determined | Component: thread
Version: Boost 1.52.0 | Severity: Regression
Resolution: | Keywords:
-------------------------------+------------------------
Comment (by anonymous):
boost::posix_time::pos_infin - positive infinity \\
boost::posix_time::neg_infin - negative infinity
time_duration td(pos_infin); \\
td.is_pos_infinity(); // --> true \\
td.is_negative(); // --> false
As I see possible this issue may be caused by some changes inside
Boost.DateTime library. I found new note in the Boost.DateTime
documentation: \\
> When a time_duration is a special value, either by construction or other
means, the following accessor functions will give unpredictable results:
hours(), minutes(), seconds(), ticks(), fractional_seconds(),
total_nanoseconds(), total_microseconds(), total_milliseconds(),
total_seconds()
So it seems that Boost.Thread incorrectry call total_milliseconds() inside
timed_wait on duration which is special value. Possible code in timed_wait
should be like:
{{{#!c++
template<typename duration_type>
bool timed_wait(unique_lock<mutex>& m,duration_type const&
wait_duration)
{
if (wait_duration.is_pos_infinity())
{
wait(m); // or do_wait(m,detail::timeout::sentinel());
return true;
}
if (wait_duration.is_special_value())
{
//throw some error
}
return do_wait(m,wait_duration.total_milliseconds());
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9708#comment:4> 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:15 UTC