Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-12-01 16:16:46

Gennadiy Rozental wrote:
>> Initial Comment:
>> When using BOOST+AUTO_UNIT_TEST and
>> macros under Windows (MSVC71) Access Violation occurs
>> in "lightweight_mutex::scoped_lock::scoped_lock".
>> This behavior produced by error in
>> "boost::detail::allocator_impl" or in Test Framework.
>> Mutex for locking created by static member. Automatic
>> unittests created by using global variables. So we have
>> using uninitialized CRITICAL_SECTION because order of
>> global variables initialization is undefined.
>> I tried to convert
>> "boost::detail::allocator_impl::mutex" from static
>> variable to Meyer's singleton (with static member
>> function which contains local static variable "mutex").
>> This solves my problem but I can't suggest any patch
>> because I can't test it with many compilers.
> This is frequently met issue with global variables. Peter will you be
> able to handle this?

I'm not sure how. Turning a mutex into a singleton defeats the whole point
of using a mutex, because it introduces an initialization race. But I'll try
to think of something that improves the current situation.

Boost list run by bdawes at, gregod at, cpdaniel at, john at