Thread safety of cout

Paolo Carlini pcarlini@suse.de
Thu Oct 7 16:46:00 GMT 2004


Dan Evison wrote:

>Is it safe to have multiple threads writing to cout without any additional
>locking?
>
>My program is getting into deadlock sometimes, it seems while writing to
>cout.  I'm running gcc 3.2.1, on linux kernel 2.4.24.  I have a gdb trace of
>each thread if that helps.
>
It would help, but is material more suited for a complete Bugzilla PR...

Anyway, it's difficult to answer your question without knowing the 
details of your
system, in particular the version of glibc; see also:

    http://gcc.gnu.org/ml/libstdc++/2003-04/msg00285.html

Current versions of gcc(i.e., 3.4.x)/glibc(i.e., 2.3.x) are OK wrt the 
locale issues that
affected older releases.

Paolo.



More information about the Libstdc++ mailing list