Boost Users :
Subject: [Boost-users] boost::date_time with BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG on MinGW: segfault on multithreading
From: Yana A Kireyonok (aka Iron Bug) (death.iron.bug_at_[hidden])
Date: 2012-01-13 06:33:19
Looks like I found a bug in date_time library when building with MinGW.
I've built static boost 1.48.0 libraries under windows (Win7 64) with
MinGW 3.20 (32 bit, GCC 4.6.1) with
BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG option and threading=multi
link=static runtime-link=static address-model=32
In this case, when using threads (-mthreads) simple operations with
timings fail. I simply created a thread that slept for some
milliseconds ten times next and it fails. I traced a little, it fails
inside date_time functions, called from this_thread::sleep() with
SIGSEGV, segmentation fault. That happens in ctor of structure
simple_time_rep, out of reasons, at first glance. Looks like this
structure or maybe standard time functions of MinGW are not reentrant
(this is my guess, I did not dig too deep in the causes of segfault).
Without flag BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG it's going all
right with timings and threads. But when using precise timings and
threading it fails.
I also tried flags BOOST_HAS_WINTHREADS and _REENTRANT - that does not
affect the case. BOOST_THREAD_USE_LIB was defined (to let it work with
Is this a bug or problem of MinGW of certain version? I haven't found
anything similar in bugtracker.
Sincerely, Yana A. Kireyonok
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