Subject: [Boost-bugs] [Boost C++ Libraries] #9720: boost::this_thread::sleep_for() sometimes returns immediately on win32
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-02-27 09:25:20
#9720: boost::this_thread::sleep_for() sometimes returns immediately on win32
---------------------------------------------------+----------------------
Reporter: Lars Hagström <lars@â¦> | Owner: anthonyw
Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
Version: Boost 1.55.0 | Severity: Problem
Keywords: chrono thread QueryPerformanceCounter |
---------------------------------------------------+----------------------
I have observed one instance of boost::this_thread::sleep_for returning
immediately instead of waiting for the specified time. This happened on a
Windows 7 32 bit machine, with Boost 1.55 and VS2012. Another relevant
thing might be that it is a VM with 2 cpus running in XenServer 6.2.
Attached is my test program, that starts a bunch of threads that all do a
sleep_for(10 minutes). Main then immediately interrupts and joins the
threads.
The threads all check whether they timed out or whether they were
interrupted. In case they time out we print the elapsed time, which of
course is expected to be 10 minutes.
Here is the output of my test program:
{{{
first test
Timeout!
Elapsed time: 0.000039s wall, 0.000000s user + 0.000000s system =
0.000000s CPU (n/a%)
.
}}}
I'm thinking that this could be something to do with the well known
strangeness of QueryPerformanceCounter (see for example #8006). The VM
host was probably under a fair bit of load at the time this test failed.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9720> 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