[serialization]Thread-safety of serialization lib

There are many places in serialization library that use a pattern like the following: static oserializer & instantiate(){ static oserializer instance; return instance; } AFAIK, not all compilers guarantee the initialization of a function level (or class member level) static variable is thread-safe. If I understand the code correctly, this essentially means that simultaneously serializing objects of the same type is not thread-safe. Am I missing something here? Thanks, Sean

Hmm - I would have to think about that. This would only be a problem in the case where multiple threads are simultaneously serializing to different archive instances. (I can't imagine multiple threads serializating to the same archive). Sorry I don't have much to say here. Robert Ramey Sean Huang wrote:
There are many places in serialization library that use a pattern like the following:
static oserializer & instantiate(){ static oserializer instance; return instance; }
AFAIK, not all compilers guarantee the initialization of a function level (or class member level) static variable is thread-safe. If I understand the code correctly, this essentially means that simultaneously serializing objects of the same type is not thread-safe. Am I missing something here?
Thanks,
Sean _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Robert, Did you mean same TYPE of archive? I think it would be common that multiple threads writes to arhives of same type. Sean From: "Robert Ramey" ramey@rrsd.com
Hmm - I would have to think about that.
This would only be a problem in the case where multiple threads are simultaneously serializing to different archive instances. (I can't imagine multiple threads serializating to the same archive). Sorry I don't have much to say here.
Robert Ramey
Sean Huang wrote:
There are many places in serialization library that use a pattern like the following:
static oserializer & instantiate(){ static oserializer instance; return instance; }
AFAIK, not all compilers guarantee the initialization of a function level (or class member level) static variable is thread-safe. If I understand the code correctly, this essentially means that simultaneously serializing objects of the same type is not thread-safe. Am I missing something here?
participants (2)
-
Robert Ramey
-
Sean Huang