[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: g++ std::string thread safe ?
From: |
Paul Pluzhnikov |
Subject: |
Re: g++ std::string thread safe ? |
Date: |
Thu, 31 May 2007 15:26:24 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) |
mathieu <mathieu.malaterre@gmail.com> writes:
> I am having some issue with a program when run in a multi threaded
> environment. The program is sporadically seg faulting with the
> following backtrace from gdb:
>
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread -1213191280 (LWP 29006)]
> 0xb7daa28e in std::string::assign () from /usr/lib/libstdc++.so.6
> (gdb) bt
> #0 0xb7daa28e in std::string::assign () from /usr/lib/libstdc++.so.6
> #1 0xb7daa364 in std::string::operator= () from /usr/lib/libstdc++.so.6
*Do* say which platform you are on. Assuming Linux/x86 because you
posted from it.
On Linux, with default gcc configuration, std::string is safe.
Valgrind is your friend here. Also try compiling with
-D_GLIBCXX_DEBUG (which catches many STL usage errors).
> Is there a way to recompile my code
> using a thread safe std::string version ?
In general, you should be compiling all of your code with '-pthread'.
But this is unlikely to make any difference for this crash.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.