Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

iostreams and thread safety

624 views
Skip to first unread message

Owen Jacobson

unread,
Jan 18, 2003, 12:43:54 PM1/18/03
to
I know the standard C++ language has no concept of threads, so this is possibly
OT. However, it is easier to get an answer to this here than in
comp.programming.threads, I suspect:

Are cin, cout, and other iostreams required to be thread-safe?

Cheers,
Owen
--
<Vosx> Hi, God. I don't want to sound like I don't appreciate you, but when I
asked you to make Shadowbane the talk of the industry, I kinda meant in a good
way.
<God> I answer prayer to crush.

Neil Butterworth

unread,
Jan 18, 2003, 12:47:38 PM1/18/03
to

"Owen Jacobson" <ojac...@mx-deus.trappenspammen.net> wrote in message
news:pan.2003.01.18....@mx-deus.trappenspammen.net...

> I know the standard C++ language has no concept of threads, so this is
possibly
> OT. However, it is easier to get an answer to this here than in
> comp.programming.threads, I suspect:
>
> Are cin, cout, and other iostreams required to be thread-safe?

As you observed, Standard C++ has no concept of threads or thread safety, so
the answer to this from a Standard C++ point of view is obviously "no".
However, your specific implementation probably does have some concept of
multi-threading, so the answer for your specific implementation may be
"yes" - consult your implementation's documentation to confirm this.

NeilB


Alexander Terekhov

unread,
Jan 18, 2003, 2:50:54 PM1/18/03
to

Owen Jacobson wrote:
>
> I know the standard C++ language has no concept of threads, so this is possibly
> OT. However, it is easier to get an answer to this here than in
> comp.programming.threads, I suspect:
>
> Are cin, cout, and other iostreams required to be thread-safe?

http://groups.google.com/groups?selm=3D2348D9.4419C431%40web.de
(Subject: Re: Thread safety of cout)

http://groups.google.com/groups?selm=3DD6B913.4C8DA209%40web.de
("....The idea is that output to the stream for the complete
statement is done atomically....")

regards,
alexander.

0 new messages