|
Boost Users : |
From: Sigurd Saue (ssaue_at_[hidden])
Date: 2006-06-30 02:49:58
Thanks a lot for your input. We will investigate this further and test the
different scenarios. I will return with some conclusions later (after the
summer holidays)
Sigurd Saue
-----Opprinnelig melding-----
Fra: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]]Pa vegne av Robert Ramey
Sendt: 29. juni 2006 17:57
Til: boost-users_at_[hidden]
Emne: Re: [Boost-users] Is serialization thread safe?
Sigurd Saue wrote:
> We use boost serialization for sending notifications from a server to
> multiple clients. The problematic scenario is when two client threads
> within the same process deserializes the same notification. In your
> words: the same archive into different object from different threads.
Hmm this same archive or same archive instance? In any case I believe the
following should work and would be very interested in knowing that it
doesn't. If it doesn't work, I would be very interested in knowing where
the problem arises.
std::ifstream is1("file);
boost::archive::text_iarchive ia1(is1);
std::ifstream is2("file);
boost::archive::text_iarchive ia2(is2);
// from thread one
object o;
ia >> o
// from thread two
object o1;
ia1 >> o1;
Of course if the archives or their input streams are shared among threads
this can't work as the state of both the archives and streams are changed by
the action of deserialization.
Robert Ramey
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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