This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Definitive answer about thread-safety of std::string


Hi,
> While libstdc++ documentation makes it clear that the library is
> thread-safe as long as an object is locked so that only a single
> concurrent thread can access it, I have seen some conflicting
> statements elsewhere that elude to the fact that std::string may be
> safe for access by concurrent threads.  I would appreciate if anyone
> could enlighten me on whether std::string is in fact safe for access
> by concurrent threads without explicit locking, or if it requires a
> read-write locks or a full locks instead.
you can find rather complete details in this PR

    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21334

in particular James' initial analysis is correct. If you want, we are
already delivering an alternate implementation under <ext/vstring.h>,
which by default doesn't use reference counting and can be more suited
for some applications. By now is pretty stable.

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]