Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5034: boost::this_thread::sleep either returns instantaneously or spins
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-06-24 01:50:34
#5034: boost::this_thread::sleep either returns instantaneously or spins
-------------------------------+--------------------------------------------
Reporter: Jamie Allsop | Owner: anthonyw
Type: Bugs | Status: closed
Milestone: To Be Determined | Component: thread
Version: Boost 1.45.0 | Severity: Showstopper
Resolution: worksforme | Keywords:
-------------------------------+--------------------------------------------
Comment (by storm@â¦):
I see the same exact problem on ubuntu 32bit, on virtualbox (mac host),
but it happens ONLY when I run the program in gdb.
Spawning 4 thread, each one cycling and sleeping for up to one second
between any cycle, I always get 1 or 2 threads that never exit from the
sleep.
Part of code:
{{{
...
cout << "Updater started with id " << boost::this_thread::get_id()
<< endl;
while (true) {
/* do things */
// Throttle
elapsed =
boost::posix_time::microsec_clock::universal_time() - this->last_update;
sleep_for = interval - elapsed;
cout << boost::this_thread::get_id() << " sleeping for "
<< sleep_for << endl;
boost::this_thread::sleep(sleep_for);
cout << boost::this_thread::get_id() << " sleeped for " <<
sleep_for << endl;
}
...
}}}
I get on console:
{{{
Updater started with id 0x8090198
Updater started with id 0x8090810
0x8090198 sleeping for 0x8090810 sleeping for 00:00:00.998689
00:00:00.997377
Updater started with id 0x8090fb0
0x8090fb0 sleeping for 00:00:00.998187
Updater started with id 0x8091378
0x8091378 sleeping for 00:00:00.998543
0x8090198 sleeped for 00:00:00.997377
0x8090198 sleeping for 00:00:00.999980
0x8090810 sleeped for 00:00:00.998689
0x8090810 sleeping for 00:00:00.999979
0x8091378 sleeped for 00:00:00.998543
0x8091378 sleeping for 00:00:00.999979
0x8090198 sleeped for 00:00:00.999980
0x8090198 sleeping for 00:00:00.999948
0x8090810 sleeped for 00:00:00.999979
0x8090810 sleeping for 00:00:00.999951
0x8091378 sleeped for 00:00:00.999979
0x8091378 sleeping for 00:00:00.999958
}}}
( 0x8090fb0 is blocked )
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5034#comment:7> 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:06 UTC