This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Thread safety of cout
Nathan Myers wrote:
I would expect any program that uses cout in more than one thread,
without locking, to fail in random ways. A deadlock or crash means
you got lucky, because by the specs in that case it's allowed to
erase your disk and impregnate your sister.
:)
Something that I still don't grasp completely is the difference between
fwrite / fwrite_unlocked and fflush / fflush_unlocked: the (glibc (*)) specs
don't seem to imply that the first two, respectively, take a lock?!? In that
case, I would exclude at least pregnancy... ;)
Paolo.
(*) To be clear with everybody, there is no such a thing as fwrite_unlocked
and fflush_unlocked in the C standard, neither in Posix...