Re: [Boost-bugs] [Boost C++ Libraries] #9720: boost::this_thread::sleep_for() sometimes returns immediately on win32

Subject: Re: [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-03-10 18:47:37


#9720: boost::this_thread::sleep_for() sometimes returns immediately on win32
-------------------------+-------------------------------------------------
  Reporter: Lars | Owner: viboes
  Hagström <lars@…> | Status: assigned
      Type: Bugs | Component: thread
 Milestone: To Be | Severity: Problem
  Determined | Keywords: chrono thread
   Version: Boost | QueryPerformanceCounter
  1.55.0 |
Resolution: |
-------------------------+-------------------------------------------------

Comment (by viboes):

 Replying to [comment:4 Lars Hagström <lars@…>]:
> I just realized what the problem is!
>
> It's not a QPC problem after all. It's the static in steady_clock::now.
 I've got 50 threads trying to initialize that static variable at the same
 time, of course things go wrong :-)
>
> No idea of how to fix it in an efficient manner, though.

 Do you mean the static in


 {{{
     static double nanosecs_per_tic =
 chrono_detail::get_nanosecs_per_tic();
 }}}

 Could you try removing the static keyword?


 {{{
   steady_clock::time_point steady_clock::now() BOOST_NOEXCEPT
   {
     double nanosecs_per_tic = chrono_detail::get_nanosecs_per_tic();
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9720#comment:5>
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