Boost logo

Boost :

Subject: Re: [boost] [thread] thread_specific_ptr and static initialization order
From: Neil Groves (neil_at_[hidden])
Date: 2010-05-09 16:53:56


On Sat, May 8, 2010 at 7:56 PM, Tanguy Fautré <tfautre_at_[hidden]> wrote:

> Hi,
>
> After upgrading from 1.42 to 1.43 (using VC10 x64), I encounter an access
> violation related to thread_specific_ptr. The program used to run fine with
> previous version of Boost on several platforms (Win x32, Win x64 and Linux
> x64).
>
> I've managed to create a small program that reproduces the problem. It
> seems to be a static initialization order related problem. If the TSS is
> initialized by a static object, the program fails (nullptr exception).
> However, if the static object is commented out, and the TSS is solely
> initialized in the main, the program runs fine.
>
> Is thread_specific_ptr supposed to work even when initialized by another
> static object? Or does it require to be initialized only after entering
> main?
>
>
I don't believe there are any inter-compilation unit dependencies hence it
should work if your initialization order is compliant with the usual C++
standard guarantees.

>
> Regards,
>
> Tanguy
>
>
The supplied C++ example does not reproduce the problem for me with the
boost trunk or the boost release branch in debug or release configurations
using the default compilation options on VC 10 Express. I have checked for
changes between the release branch and the 1.43 release and nothing relevant
appears to have changed.

Would you please provide more details about how to reproduce the problem?

Regards,
Neil Groves


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk