Boost logo

Boost :

Subject: Re: [boost] Thread (win32) and current_thread_tls_key issues
From: Pekka Seppänen (pekka.seppanen_at_[hidden])
Date: 2012-07-03 02:41:10

On 2.7.2012 20:11, Vicente J. Botet Escriba wrote:
> Le 02/07/12 10:50, Pekka Seppänen a écrit :
>> Hi,
>> Currently Threads's Win32 TLS implementation uses a global static variable
>> thread::current_thread_tls_key that is defined in src/win32/thread.cpp. As you
>> may know, static variables have a tendency of not being allocated in a very
>> specific order.
>> blah blah
> Hi,
> Thanks for the report and the deep analysis.
> Please, create a ticket, I will give it a try soon.
> A test case that shows the problem and that your patch is a solution would be
> much appreciated.

Ok, created a ticked #7066 ( with
the patch attached.

Not really sure how to write a test case for this, I guess it becomes a
tedious job even if you could predict the initialization order for each
compiler version.

Anyway, the way I spotted this in the first place was to simply add a memory
write breakpoint for current_thread_tls_key; Saw it was initialized after it
was used for the first time (didn't check release builds, but at least MSVC9
debug builds have a simple loop before entry point that do this kind of init

-- Pekka

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