Re: [Boost-bugs] [Boost C++ Libraries] #6787: boost::thread::sleep() hangs if system time is rolled back

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6787: boost::thread::sleep() hangs if system time is rolled back
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-10-27 10:49:54


#6787: boost::thread::sleep() hangs if system time is rolled back
-----------------------------------------------+---------------------
  Reporter: Artem Gayardo-Matrosov <boost@…> | Owner: viboes
      Type: Bugs | Status: closed
 Milestone: Boost 1.60.0 | Component: thread
   Version: Boost 1.49.0 | Severity: Problem
Resolution: fixed | Keywords:
-----------------------------------------------+---------------------

Comment (by ueli.marti@…):

 I made some tests with develop branch on following platforms:[[BR]]
 ARM/Linux, glibc 2.17[[BR]]
 ARM/Linux, glibc 2.19[[BR]]
 i386/Ubuntu 12.04, glibc 2.17[[BR]]
 i386/Ubuntu 14.04, glibc 2.19[[BR]]
 i386/Ubuntu 15.04, glibc 2.21[[BR]]
 [[BR]]
 Without any special #define we have the same behavior with boost.1.59 and
 with develop branch:
 - On all platforms with glibc 2.17, if system clock is rolled back during
 boost::this_thread::sleep_for() or boost::condition_variable::timedWait(),
 the sleep/wait terminates after the initially specified duration (expected
 behavior)[[BR]]
 - On all other platforms (glibc 2.19 or 2.21), if system clock is rolled
 back during boost::this_thread::sleep_for() or
 boost::condition_variable::timedWait(), the sleep/wait "hangs", i.e.
 terminates only when the initial time + duration is expired[[BR]]

 With develop branch and #define
 BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC the behavior is the same for
 all tested platforms:[[BR]]
 - boost::this_thread::sleep_for() terminates after the initially specified
 duration (expected behavior)[[BR]]
 - boost::condition_variable::timedWait() does never timeout, even without
 touching system clock. The wait can be terminated only by signalling the
 condition variable or by interrupting the thread.[[BR]]

 I then tested the native api pthread_cond_timedwait() directly, with
 pthread_condattr_setclock(CLOCK_MONOTONIC).[[BR]]
 On all platforms the behavior is as i expect it: if system clock is rolled
 back during pthread_cond_timedwait() the wait terminates after the
 initially specified duration[[BR]]
 [[BR]]
 I will repeat my tests when boost 1.60 is released.[[BR]]

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6787#comment:66>
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