|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2008-07-28 10:21:09
on Mon Jul 28 2008, Vladimir Prus <vladimir-AT-codesourcery.com> wrote:
> Robert Ramey wrote:
>
>> The reason I ask is that the serialization library uses
>> spirit to parse xml archives. Recently, I made changes
>> to make the library thread-safe. I did this without using
>> mutexes/locks by confine all non-const operations to
>> construction and destruction and using static object
>> constructed/destructed at pre-main and post main
>> time time. Although the jury is still out on this, I believe
>> it will make the serialization library thread safe without
>> the need for using threading primitives and libraries.
>
> What happens if one explicitly loads a dynamic library, which uses
> serialization? I'd guess the types serialized by that library should
> be added to the global table of serialized type (at least for types
> marked with BOOST_CLASS_EXPORT), so it's non-const operation done
> after main. Am I missing something?
Suggestion: handle that by deferring the availability of the
registrations associated with that DLL until the user explicitly says
it's safe to add them. The idea is that every DLL adds things to its
local registry and in a MT application, that is only combined with the
global registry via an explicit call, when presumably the user knows no
threads are doing serialization.
HTH,
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk