Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8006: Boost::Chrono Assertion at startup - steady_clock::now() - Windows
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-03-26 20:52:28
#8006: Boost::Chrono Assertion at startup - steady_clock::now() - Windows
-----------------------------+---------------------
Reporter: meckschlager@⦠| Owner: viboes
Type: Bugs | Status: closed
Milestone: Boost 1.56.0 | Component: chrono
Version: Boost 1.50.0 | Severity: Problem
Resolution: fixed | Keywords:
-----------------------------+---------------------
Comment (by CharlesSavoie):
I too hit this assertion on first use once in a while. It seems unlikely
that QueryPerformanceCounter is failing on any modern hardware, or
especially that calling it again would solve the problem.
However, the "static double nanosecs_per_tic" is definitely a problem in a
multithreaded environment since the return value could be used by one
thread before another thread has finished calling the
chrono_detail::get_nanosecs_per_tic() function and assigning the value.
Static local variables are never to be used in a multithreaded
environment, which an MSDN blog post explains. I can't post a link here,
so please search for "C++ scoped static initialization is not thread-safe,
on purpose!".
I would recommend rethinking this method and all methods that use static
local variables.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/8006#comment:24> 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:18 UTC