Boost logo

Boost Users :

Subject: Re: [Boost-users] [Thread] thousands of spurious wakeups from timed_wait() per second
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2014-09-12 06:35:02


On 11 Sep 2014 at 16:17, Steve Clark wrote:

> I converted the test program to make pthread calls instead of Boost. It
> works perfectly, just like your Mac run. This is unsatisfactory because
> eventually I want the same code to run on Windows.
>
> I've been suspicious that timed_wait() isn't actually waiting at all - just
> doing something like yield(). When I added a check for the current time vs.
> the timeout deadline into my test program, the number of spurious wakeups
> dropped almost to half, suggesting to me that the
> boost::posix_time::microsec_clock::local_time() call almost doubles the time
> it takes to run through the inner loop.

Hmm. Maybe my timer changes on Windows for 1.56 are broken? I have to
admit I relied on the unit test suite instead of manually checking I
made the time calculations correctly. I believe there is a test in
the unit test which checks that sleeping for a second really did take
roughly a second.

Can you test 1.55 or some earlier Boost?

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ 
http://ie.linkedin.com/in/nialldouglas/



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net