From: Robert Ramey (ramey_at_[hidden])
Date: 2008-07-28 03:18:46
You're absolutely correct.
So technically, the library is not thread safe. One cannot dynamically
dlls while archives are being save or loaded. So I guess I should
say its thread safe except for a small set of specific operations which
must be sequenced.
I started out looking at various ways of using mutexes. But they all
led to the requirement that I link in the threading library and a large
slow down in the save/load operations. After much consideration
I felt that "aiming lower" was the correct choice in this case. This
experience has made me a little wary of the mutex approach to
multi-core processing and increased my interest in lock-free
And when I looked into spirit, for the first time in a very long
time, it occured to me that spirit might benefit from using a similar
approach. If it can't, the usage of spirit for xml input has
made the serialization library again dependent on the threading
I anxiously await more information on this.
Vladimir Prus 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?
> - Volodya
> Unsubscribe & other changes: