[Boost-bugs] [Boost C++ Libraries] #12519: boost::thread::try_join_for does not return after timeout

Subject: [Boost-bugs] [Boost C++ Libraries] #12519: boost::thread::try_join_for does not return after timeout
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-10-11 13:31:23


#12519: boost::thread::try_join_for does not return after timeout
------------------------------+----------------------
 Reporter: mweb@… | Owner: anthonyw
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
  Version: Boost 1.61.0 | Severity: Problem
 Keywords: |
------------------------------+----------------------
 If we use BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC try_join_for does
 not abort after the given timeout anymore. If I remove the define it works
 again.

 We use the define to be able to use sleep_for while changing the system
 time. (See #6787)

 To Reproduce:

 {{{

 #define BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC

 #include <iostream>
 #include <boost/thread.hpp>

 void test_func()
 {
     boost::this_thread::sleep_for(boost::chrono::milliseconds(1500));
 }

 int main()
 {
     boost::thread t(test_func);

     if (!t.try_join_for(boost::chrono::milliseconds(50))) {
         std::cout << "OK" << std::endl;
     } else {
         std::cout << "FAILED" << std::endl;
     }

     if (t.try_join_for(boost::chrono::milliseconds(2000))) {
         std::cout << "OK" << std::endl;
     } else {
         std::cout << "FAILED" << std::endl;
     }
 }

 }}}

 If the define is available the first try_join_for waits till the thread is
 finished, the expected behavior would be that the first try_join_for would
 return before the thread is finished.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12519>
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