This is the mail archive of the
mailing list for the libstdc++ project.
Re: std::string & multithreading
- From: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- To: Radu Marginean <radu_marg at yahoo dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Sat, 27 Feb 2010 16:20:07 +0000
- Subject: Re: std::string & multithreading
- References: <firstname.lastname@example.org>
On 26/02/2010 20:06, Radu Marginean wrote:
> Is there any method to avoid this problem?
Standard synchronisation techniques should be used to protect shared
strings, just as for any other object or resource. You wouldn't expect to get
away with linking or unlinking items from a list in multiple threads in
parallel without wrapping a lock or semaphore around the operation; same goes
for strings and string operations.