Boost logo

Boost :

Subject: Re: [boost] [Block Pointer] multithread help
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2011-05-13 10:06:26


On Thursday, May 12, 2011, Phil Bouchard wrote:
> Hi everybody,
>
> I was wondering if there is anybody familiar enough with Block Pointer
> that could give me a hand regarding multithread support. Once again the
> test file is at:
> https://svn.boost.org/svn/boost/sandbox/block_ptr/libs/smart_ptr/example/
> thread_test.cpp
>
> The main class I am trying to protect with a mutex is block_header from:
> https://svn.boost.org/svn/boost/sandbox/block_ptr/boost/block_ptr.hpp

It looks like you might be affected by the "static initialization order
fiasco". Your test creates a global block_ptr, whose constructor seems to
eventually use some class static boost::mutex. It's not clear that the
constructors for the static boost::mutex will necessarily be run before the
constructor of your global block_ptr.




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