Re: [Boost-bugs] [Boost C++ Libraries] #11562: (condition_variable_any::wait_until + recursive_mutex + steady_clock) timer expires after computer time is set forward on Ubuntu 64-bit

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11562: (condition_variable_any::wait_until + recursive_mutex + steady_clock) timer expires after computer time is set forward on Ubuntu 64-bit
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-02-28 19:02:09


#11562: (condition_variable_any::wait_until + recursive_mutex + steady_clock) timer
expires after computer time is set forward on Ubuntu 64-bit
---------------------------+----------------------------------------
  Reporter: boriss@… | Owner: viboes
      Type: Bugs | Status: reopened
 Milestone: Boost 1.60.0 | Component: thread
   Version: Boost 1.59.0 | Severity: Showstopper
Resolution: | Keywords: steady_clock, Linux 64-bit
---------------------------+----------------------------------------

Comment (by viboes):

 Replying to [comment:50 boriss@…]:
> Replying to [comment:48 viboes]:
> > Could you post a complete example with the back trace of the
 segmentation fault?
> Please find attached example (ThreadsTest.cpp) and back trace (gdb.bt)

 The backtrace is pointing to lines that let me think that
 BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC is not defined.


 {{{
 #4 0x00000000004339de in
 boost::condition_variable_any::wait_until<boost::unique_lock<boost::recursive_mutex>,
 boost::chrono::duration<long, boost::ratio<1l, 1000000000l> > >
 (this=0x7fffffffe108, lock=..., t=...) at
 /usr/local/include/boost/thread/pthread/condition_variable.hpp:311
 }}}

 Am I missing something?


 Anyway, the bt indicates a loop on line 311. The code in line #311 is


 {{{
         template <class lock_type, class Duration>
         cv_status
         wait_until(
             lock_type& lock,
             const chrono::time_point<chrono::steady_clock, Duration>& t)
         {
             using namespace chrono;
             typedef time_point<steady_clock, nanoseconds> nano_sys_tmpt;
             wait_until(lock,
 nano_sys_tmpt(ceil<nanoseconds>(t.time_since_epoch())));
             return steady_clock::now() < t ? cv_status::no_timeout :
                                              cv_status::timeout;
         }
 }}}


 The problem is in line #339


 {{{
         inline cv_status wait_until(
             unique_lock<mutex>& lk,
             chrono::time_point<chrono::steady_clock, chrono::nanoseconds>
 tp)
         {
             using namespace chrono;
             nanoseconds d = tp.time_since_epoch();
             timespec ts = boost::detail::to_timespec(d);
             if (do_wait_until(lk, ts)) return cv_status::no_timeout;
             else return cv_status::timeout;
         }
 }}}


 Instead of using


 {{{
             lock_type& lock,
 }}}

 uses


 {{{
             unique_lock<mutex>& lk,
 }}}

 Hrr. I will fix this very quickly.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11562#comment:52>
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:19 UTC