Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-09-16 02:35:31


Daniel F. Savarese wrote:
> In message <20060911172413.74527.qmail_at_[hidden]>,
> smith smit hson writes:
>> This is regarding the boost serialization library. Is
>> it possible to append to a pre-existing archive file?
>
> I don't think anyone's answered this yet. The answer is yes.

Hmmm - that would surprise me.

>
> While on the topic of boost serialization, I'll add an unrelated note
> that you cannot safely serialize objects from different threads when
> using separate archive instances in each thread. Boost serialization
> uses local static variables in places like
> boost:archive::detail::oserializer::instantiate(), so even though
> you're
> using separate archive instances, there's only a single serializer for
> a given archive type/object type pair.

True - but this should be no problem since the the static object never
changes.
That is all the functions on this static object ar "const" so they should be
re-entrant.

Therefore, if you concurrently
> serialize the same type of object with separate instances of the same
> archive type, you can segfault.

I don't see this.

> The solution of course is to use
> critical sections or delegate all serialization to a single thread.
> But you wouldn't expect to have to do so when using separate
> instances because the global behavior is not obvious to the API user.

I don't think this should be necessary. If it is, then it is contraty to my
intentation.

Robert Ramey


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net