Hi there, I remember that, a few months ago, there was a discussion that Boost.Serialization was currently only thread-safe when using g++ . I cannot find any specific information on this topic, however. I have distinct objects, each of which is serialized in its own (boost) thread and then sent over a network connection and deserialized at the other end. Seems to work fine, without synchronization between different serialization calls. I am using Boost 1.34.1 with Asio 0.3.8, together with threadpool 0.2.4. This is on an OpenSuSE 10.3 box with g++ 4.2.1 . Will I run into trouble when I port this to other compilers + platforms ? Thanks and Best Regards, Ruediger
On Thu, 06 Dec 2007 22:47:02 +0100, Ruediger Berlich wrote:
I am using Boost 1.34.1 with Asio 0.3.8, together with threadpool 0.2.4. This is on an OpenSuSE 10.3 box with g++ 4.2.1 .
Try compiling with g++ -fno-threadsafe-statics
Will I run into trouble when I port this to other compilers + platforms ?
My guess is yes. Asio doesn't actually create threads does it? I thought it was multiplexing something or the other. -- Sohail Somani http://uint32t.blogspot.com
Will I run into trouble when I port this to other compilers + platforms ?
My guess is yes.
Asio doesn't actually create threads does it? I thought it was multiplexing something or the other.
True. But it is rather easy to combine it with threads, e.g. with the threadpool from threadpool.sf.net . See the corresponding postings "async_accept: Serial or multi-threaded" comp.lib.boost.asio.user and the code I have proposed there. Thanks and Best Regards, Ruediger
Currently, the serialization library cannot be considered thread safe. It turns out that there are some shared static variables associated with type tables. These tables could change at run time. If using multiple archives simultaneously in different threads there could be a race condition. Its possible that that in a particular program no such condition would/could ever arise and it would be safe. But in general that could not be guarenteed. The next version currently on the branch "serialization_next_release" addresses this situation in a definitive way. I would expect to see this enhancements to be part of boost 1.36 Robert Ramey Ruediger Berlich wrote:
Hi there,
I remember that, a few months ago, there was a discussion that Boost.Serialization was currently only thread-safe when using g++ . I cannot find any specific information on this topic, however.
I have distinct objects, each of which is serialized in its own (boost) thread and then sent over a network connection and deserialized at the other end.
Seems to work fine, without synchronization between different serialization calls.
I am using Boost 1.34.1 with Asio 0.3.8, together with threadpool 0.2.4. This is on an OpenSuSE 10.3 box with g++ 4.2.1 .
Will I run into trouble when I port this to other compilers + platforms ?
Thanks and Best Regards, Ruediger
On Thu, 06 Dec 2007 17:50:43 -0800, Robert Ramey wrote:
The next version currently on the branch "serialization_next_release" addresses this situation in a definitive way. I would expect to see this enhancements to be part of boost 1.36
Thanks for doing the work Robert. Many people appreciate it. -- Sohail Somani http://uint32t.blogspot.com
I noticed you've shown interest and familiarity with this problem in the past. I made a few false starts in getting this working to my satisfaction. I came with a solution that has no locking which was important to me. But its only applicable in some applications and serialization library is one of them. In anycase I would welcome comments from anyone who has interest in looking at it. Robert Ramey Sohail Somani wrote:
On Thu, 06 Dec 2007 17:50:43 -0800, Robert Ramey wrote:
The next version currently on the branch "serialization_next_release" addresses this situation in a definitive way. I would expect to see this enhancements to be part of boost 1.36
Thanks for doing the work Robert. Many people appreciate it.
Sure, I will definitely take a look. On Thu, 06 Dec 2007 21:09:46 -0800, Robert Ramey wrote:
I noticed you've shown interest and familiarity with this problem in the past. I made a few false starts in getting this working to my satisfaction. I came with a solution that has no locking which was important to me. But its only applicable in some applications and serialization library is one of them. In anycase I would welcome comments from anyone who has interest in looking at it.
Robert Ramey
Sohail Somani wrote:
On Thu, 06 Dec 2007 17:50:43 -0800, Robert Ramey wrote:
The next version currently on the branch "serialization_next_release" addresses this situation in a definitive way. I would expect to see this enhancements to be part of boost 1.36
Thanks for doing the work Robert. Many people appreciate it.
-- Sohail Somani http://uint32t.blogspot.com
At 9:09 PM -0800 12/6/07, Robert Ramey wrote:
I came with a solution that has no locking which was important to me. But its only applicable in some applications and serialization library is one of them. In anycase I would welcome comments from anyone who has interest in looking at it.
I'm interested. Can you provide some pointers to specific places to look? I should have some time for this (and the test case for the polymorphic archive performance patch) after next week.
the SVN branch serialization_next_release contains this code. However best wait til monday as I need to upload a couple of tweaks. Robert Ramey Kim Barrett wrote:
At 9:09 PM -0800 12/6/07, Robert Ramey wrote:
I came with a solution that has no locking which was important to me. But its only applicable in some applications and serialization library is one of them. In anycase I would welcome comments from anyone who has interest in looking at it.
I'm interested. Can you provide some pointers to specific places to look? I should have some time for this (and the test case for the polymorphic archive performance patch) after next week.
Dear Robert, I would like to second Sohail Somani's statement - I really appreciate all the work you have put into this library. Thanks for making C++ programming an enjoyable experience ! :-) Best Regards, Ruediger Berlich Robert Ramey wrote:
Currently, the serialization library cannot be considered thread safe.
It turns out that there are some shared static variables associated with type tables. These tables could change at run time. If using multiple archives simultaneously in different threads there could be a race condition. Its possible that that in a particular program no such condition would/could ever arise and it would be safe. But in general that could not be guarenteed.
The next version currently on the branch "serialization_next_release" addresses this situation in a definitive way. I would expect to see this enhancements to be part of boost 1.36
Robert Ramey
participants (4)
-
Kim Barrett
-
Robert Ramey
-
Ruediger Berlich
-
Sohail Somani