Boost logo

Boost :

Subject: Re: [boost] [interprocess][trunk][windows] named_mutex doesn't work whithin a DLL
From: joaquin_at_[hidden]
Date: 2010-09-10 08:41:52


Ion Gaztañaga escribió:
> El 10/09/2010 8:13, joaquin_at_[hidden] escribió:
>
>> Ion Gaztañaga escribió:
>>
>>> The lazy init does not work because somehow get() is being called in a
>>> static object (static_initializer()->init()), so it's lazily but *too
>>> early* instantiated.
>>>
>> This is aspect of Boost.Flyweight is by design, instantiation of the
>> singleton class is made
>> during the program dynamic initialization phase so as to avoid
>> concurrency problems
>> to a large extent (see http://tinyurl.com/38jknra ).
>>
>
> Threading shouldn't be a problem, because lazy initialization is
> serialized through mutexes (even the non-lazy initialization, because
> non-lazy is just using lazy initialization in a static object). Two
> threads calling get() shouldn't lead to a race condition when obtaining
> a pointer to the singleton. Further concurrent usage should be of course
> protected by the user.
>

I understand this would allow me to avoid program dynamic initialization
in the
particular case of intermodule_holder, but Boost.Flyweight handles other
types
of holders which are not synchronized, so I cannot adop this on a
general basis :-)

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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