<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Input/Output Library Thread Safety</title>
</head>

<body>

<p>Document number:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; N2760 = 08-0270<br>
Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y-%m-%d" startspan -->2008-09-16<!--webbot bot="Timestamp" endspan i-checksum="12607" --><br>
Project:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Programming Language C++, Library Working Group<br>
Reply-to:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Beman Dawes &lt;bdawes at acm.org&gt; </p>

<h1>Input/Output Library Thread Safety</h1>

<p>The Library Working Group has identified a need to specify thread safety 
requirements for Chapter 27, Input/Output Library, components.</p>

<p>This proposal is the result of discussion at the San Francisco meeting of the 
needs and expectations of users and implementers. It is believed to represent a 
great deal of existing practice over a long period of time.</p>

<h2>Proposed wording</h2>
<p>To 27.1 Iostreams requirements [iostreams.requirements], add a new 
subsection:</p>
<blockquote>
  <p>27.1.3 Thread safety [iostreams.thread-safety]</p>
  <p>Concurrent access to a stream object [string.streams, 
  file.streams], stream buffer object [stream.buffers], or C Library stream [c.files] 
  by multiple threads may result in a data race [intro.multithread] unless 
  otherwise specified [iostream.objects]. [<i>Note:</i> 
  Data races result in undefined behavior [intro.multithread]. <i>--end note</i>]</p>
</blockquote>
<p>To 27.3 Standard iostream objects [iostream.objects], add a new paragraph at 
the end of the section:</p>
<blockquote>
  <p>Concurrent access to a synchronized [ios.members.static] standard iostream object's 
  formatted and unformatted input [istream] and output [ostream] functions or a standard C stream by 
  multiple threads shall not result in a data race [intro.multithread]. [<i>Note:
  </i>Users must still synchronize concurrent use of these objects and streams 
  by multiple threads if they wish to avoid interleaved characters. <i>-- end 
  note</i>]</p>
</blockquote>

</body>

</html>