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-20 07:38:51


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

Comment (by viboes):

 Sorry for the late response.

 I meant if you write the same program using directly the pthread set clock
 monotonic,


 {{{
   namespace detail {
     inline int monotonic_pthread_cond_init(pthread_cond_t& cond) {

 #ifdef BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC
             pthread_condattr_t attr;
             int res = pthread_condattr_init(&attr);
             if (res)
             {
               return res;
             }
             pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
             res=pthread_cond_init(&cond,&attr);
             pthread_condattr_destroy(&attr);
             return res;
 #else
             return pthread_cond_init(&cond,NULL);
 #endif
     }
   }
 }}}


 But don't compiling and hanging is not the same.

 I guess that that your ARM/linux doesn't supports monotonic clocks.

 I need to protect line 130 with BOOST_CHRONO_HAS_CLOCK_STEADY

 You can change

 {{{
         system_clock::time_point c_timeout = system_clock::now() +
 ceil<nanoseconds>(d);
 }}}


 but no chance to fix the ticket issue on this platform. You will need to
 use no_interruption_point::sleep_for on this platform which of course is
 not interruptible.

 I will update v2/thread.hpp to make use of system_clock when there is no
 steady_clock.

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