Subject: Re: [boost] [interprocess][trunk][windows] named_mutex doesn't work whithin a DLL
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2010-09-10 07:04:18


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.

Best,

Ion