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: 2013-12-11 01:26:24
#6787: boost::thread::sleep() hangs if system time is rolled back
-----------------------------------------------+----------------------
Reporter: Artem Gayardo-Matrosov <boost@â¦> | Owner: viboes
Type: Bugs | Status: reopened
Milestone: | Component: thread
Version: Boost 1.49.0 | Severity: Problem
Resolution: | Keywords:
-----------------------------------------------+----------------------
Comment (by Ki Hong Lee <clydelee@â¦>):
new example:
{{{
#include <iostream>
#include <boost/thread.hpp>
// 1.55.0
void boost_func()
{
while (true) {
// libs/thread/src/pthread/thread.cpp : 442
// while( thread_info->sleep_condition.do_wait_for(lk,ts)) {}
boost::this_thread::sleep_for(boost::chrono::seconds(1));
std::cout << "i'm boost_func !" << std::endl;
}
}
// Similar to the 1.51.0 version of the sleep_for
void posix_func()
{
::timespec tm, tm1;
while (true) {
tm.tv_sec = 1;
tm.tv_nsec = 0;
::nanosleep(&tm, &tm1);
std::cout << "\ti'm posix_func !" << std::endl;
}
}
int main()
{
boost::thread_group threads;
threads.create_thread(boost_func);
threads.create_thread(posix_func);
threads.join_all();
return 0;
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6787#comment:12> 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