#8006 closed Support Requests (fixed)
Boost::Chrono Assertion at startup — at Version 8
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Component: | chrono | |
Version: | Boost 1.50.0 | Severity: | Problem |
Keywords: | Cc: |
Description (last modified by )
steady_clock::time_point now = steady_clock::now(); sometimes causes
Assertion failed: 0 && "Boost::Chrono - Internal Error", file C:\Projects\Librari es\src\boost\boost_1_48_0\boost/chrono/detail/inlined/win/chrono.hpp, line 44 on Windows XP, boost 1.48
Change History (8)
follow-up: 2 comment:1 by , 10 years ago
comment:2 by , 10 years ago
Replying to meckschlager@…:
Now I see, boost::chrono is all thread unsafe and I was reading the time from 2 threads simultaneously (I guess that's so not uncommon)
Why do you think that the code is thread unsafe?
Is that really good? Locking the time reading method seems a bit weird to me...
What is weird for you?
comment:3 by , 10 years ago
Replying to meckschlager@…:
steady_clock::time_point now = steady_clock::now(); sometimes causes Assertion failed: 0 && "Boost::Chrono - Internal Error", file C:\Projects\Librari es\src\boost\boost_1_48_0\boost/chrono/detail/inlined/win/chrono.hpp, line 44 on Windows XP, boost 1.48
The code in question is
if ( (nanosecs_per_tic <= 0.0L) || (!boost::detail::win32::QueryPerformanceCounter( &pcount )) ) { BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); return steady_clock::time_point(); }
could you check which condition is true?
follow-up: 5 comment:4 by , 10 years ago
Hi, thanks embracing that issue up!
Why do you think that the code is thread unsafe?
It states so in the chrono users guide "All functions in the library are thread-unsafe except when noted explicitly." (http://www.boost.org/doc/libs/1_52_0/doc/html/chrono/users_guide.html) thats why I came to the working solution
lock steady_clock::time_point now = steady_clock::now(); unlock
Now, it just seems unnecessary that multiple threads might have to wait to get the current time, which many os methods would return without requiring a lock.
cheers m.
comment:5 by , 10 years ago
Replying to meckschlager@…:
Hi, thanks embracing that issue up!
Why do you think that the code is thread unsafe?
It states so in the chrono users guide "All functions in the library are thread-unsafe except when noted explicitly." (http://www.boost.org/doc/libs/1_52_0/doc/html/chrono/users_guide.html) thats why I came to the working solution
lock steady_clock::time_point now = steady_clock::now(); unlock
Now, it just seems unnecessary that multiple threads might have to wait to get the current time, which many os methods would return without requiring a lock.
Hrr! I would fix this on the documentation, call to Clock::now() should be thread safe.
Thanks for the report.
follow-up: 7 comment:6 by , 10 years ago
Status: | new → assigned |
---|
I have fixed the documentation in revision [83511]. have you analyzed which condition was failing?
comment:7 by , 10 years ago
comment:8 by , 9 years ago
Description: | modified (diff) |
---|---|
Resolution: | → worksforme |
Status: | assigned → closed |
I can not reproduce this error. Without your help I'm unable to help you? Reopen it if you have some insight.
Now I see, boost::chrono is all thread unsafe and I was reading the time from 2 threads simultaneously (I guess that's so not uncommon) Is that really good? Locking the time reading method seems a bit weird to me...