<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 962: Various threading bugs #12</title>
<meta property="og:title" content="Issue 962: Various threading bugs #12">
<meta property="og:description" content="C++ library issue. Status: C++11">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue962.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#C++11">C++11</a> status.</em></p>
<h3 id="962"><a href="lwg-defects.html#962">962</a>. Various threading bugs #12</h3>
<p><b>Section:</b> 32.6.5.4.3 <a href="https://wg21.link/thread.lock.unique.locking">[thread.lock.unique.locking]</a> <b>Status:</b> <a href="lwg-active.html#C++11">C++11</a>
 <b>Submitter:</b> Pete Becker <b>Opened:</b> 2009-01-07 <b>Last modified:</b> 2016-01-28</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View all other</b> <a href="lwg-index.html#thread.lock.unique.locking">issues</a> in [thread.lock.unique.locking].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#C++11">C++11</a> status.</p>
<p><b>Discussion:</b></p>
<p>
32.6.5.4.3 <a href="https://wg21.link/thread.lock.unique.locking">[thread.lock.unique.locking]</a>:  <code>unique_lock::lock</code> is
required to throw an object of type <code>std::system_error</code> "when the
postcondition cannot be achieved." The postcondition is <code>owns == true</code>,
and this is trivial to achieve. Presumably, the requirement is intended
to mean something more than that.
</p>

<p><i>[
Summit:
]</i></p>

<blockquote><p>
Move to open.
</p></blockquote>

<p><i>[
Beman has volunteered to provide proposed wording.
]</i></p>


<p><i>[
2009-07-21 Beman added wording to address 32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>
in response to the Frankfurt notes in <a href="lwg-defects.html#859" title="Monotonic Clock is Conditionally Supported? (Status: C++11)">859</a><sup><a href="https://cplusplus.github.io/LWG/issue859" title="Latest snapshot">(i)</a></sup>.
]</i></p>


<p><i>[
2009-09-25 Beman: minor update to wording.
]</i></p>


<p><i>[
2009-10 Santa Cruz:
]</i></p>


<blockquote><p>
Move to Ready.
</p></blockquote>



<p id="res-962"><b>Proposed resolution:</b></p>

<p><i>Change Exceptions 32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a> as indicated:</i></p>
<blockquote>
<p>Some functions described in this Clause are specified to throw exceptions of 
type <code>system_error</code> (19.5.5). Such exceptions shall be thrown if <ins>
any of the <i>Error conditions</i> are detected or</ins> a call to an operating 
system or other underlying API results in an error that prevents the library 
function from <del>satisfying its postconditions or from returning a meaningful 
value</del> <ins>meeting its specifications</ins>. <ins>Failure to
allocate storage shall be reported as described in
16.4.6.14 <a href="https://wg21.link/res.on.exception.handling">[res.on.exception.handling]</a>.</ins></p>
</blockquote>

<p><i>Change thread assignment 32.4.3.6 <a href="https://wg21.link/thread.thread.member">[thread.thread.member]</a>, join(), 
paragraph 8 as indicated:</i></p>
<blockquote>
<p><i>Throws:</i> <code>std::system_error</code> when <del>the postconditions cannot be achieved</del> <ins>an exception is required (32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>)</ins>.</p>

</blockquote>

<p><i>Change thread assignment 32.4.3.6 <a href="https://wg21.link/thread.thread.member">[thread.thread.member]</a>, detach(), paragraph 
13 as indicated:</i></p>
<blockquote>

<p><i>Throws:</i> <code>std::system_error</code> when <del>the effects or 
postconditions cannot be achieved</del> <ins>an exception is required (32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>)</ins>.</p>

</blockquote>

<p><i>Change Mutex requirements 32.6.4 <a href="https://wg21.link/thread.mutex.requirements">[thread.mutex.requirements]</a>, paragraph 
11, as indicated:</i></p>
<blockquote>

<p><i>Throws:</i> <code>std::system_error</code> when <del>the effects or 
postcondition cannot be achieved</del> <ins>an exception is required (32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>)</ins>.</p>
</blockquote>
<p><i>Change unique_lock locking 32.6.5.4.3 <a href="https://wg21.link/thread.lock.unique.locking">[thread.lock.unique.locking]</a>, 
paragraph 3, as indicated:</i></p>
<blockquote>

<p><i>Throws:</i> <code>std::system_error</code> when <del>the  postcondition cannot be 
achieved</del> <ins>an exception is required (32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>)</ins>.</p>
</blockquote>
<p><i>Change unique_lock locking 32.6.5.4.3 <a href="https://wg21.link/thread.lock.unique.locking">[thread.lock.unique.locking]</a>, 
paragraph 8, as indicated:</i></p>
<blockquote>

<p><i>Throws:</i> <code>std::system_error</code> when <del>the  postcondition cannot be 
achieved</del> <ins>an exception is required (32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>)</ins>.</p>
</blockquote>
<p><i>Change unique_lock locking 32.6.5.4.3 <a href="https://wg21.link/thread.lock.unique.locking">[thread.lock.unique.locking]</a>, 
paragraph 13, as indicated:</i></p>
<blockquote>

<p><i>Throws:</i> <code>std::system_error</code> when <del>the  postcondition cannot be 
achieved</del> <ins>an exception is required (32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>)</ins>.</p>
</blockquote>
<p><i>Change unique_lock locking 32.6.5.4.3 <a href="https://wg21.link/thread.lock.unique.locking">[thread.lock.unique.locking]</a>, 
paragraph 18, as indicated:</i></p>
<blockquote>

<p><i>Throws:</i> <code>std::system_error</code> when <del>the  postcondition cannot be 
achieved</del> <ins>an exception is required (32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>)</ins>.</p>
</blockquote>
<p><i>Change unique_lock locking 32.6.5.4.3 <a href="https://wg21.link/thread.lock.unique.locking">[thread.lock.unique.locking]</a>, 
paragraph 22, as indicated:</i></p>
<blockquote>

<p><i>Throws:</i> <code>std::system_error</code> when <del>the  postcondition cannot be 
achieved</del> <ins>an exception is required (32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>)</ins>.</p>
</blockquote>
<p><i>Change Function call_once 32.6.7.2 <a href="https://wg21.link/thread.once.callonce">[thread.once.callonce]</a>, paragraph 4, as 
indicated</i></p>
<blockquote>
  <p><i>Throws:</i> <code>std::system_error</code> when <del>the effects cannot be 
  achieved</del> <ins>an exception is required (32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>)</ins>, 
  or any exception thrown by <code>func</code>.</p>
</blockquote>
<p><i>Change Class condition_variable 32.7.4 <a href="https://wg21.link/thread.condition.condvar">[thread.condition.condvar]</a>, 
paragraph 12, as indicated:</i></p>
<blockquote>

<p><i>Throws:</i> <code>std::system_error</code> when <del>the effects or 
postcondition cannot be achieved</del> <ins>an exception is required (32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>)</ins>.</p>
</blockquote>
<p><i>Change Class condition_variable 32.7.4 <a href="https://wg21.link/thread.condition.condvar">[thread.condition.condvar]</a>, 
paragraph 19, as indicated:</i></p>
<blockquote>

<p><i>Throws:</i> <code>std::system_error</code> when <del>the effects or 
postcondition cannot be achieved</del> <ins>an exception is required (32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>)</ins>.</p>
</blockquote>
<p><i>Change Class condition_variable_any 32.7.5 <a href="https://wg21.link/thread.condition.condvarany">[thread.condition.condvarany]</a>, 
paragraph 10, as indicated:</i></p>
<blockquote>

<p><i>Throws:</i> <code>std::system_error</code> when <del>the effects or 
postcondition cannot be achieved</del> <ins>an exception is required (32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>)</ins>.</p>
</blockquote>
<p><i>Change Class condition_variable_any 32.7.5 <a href="https://wg21.link/thread.condition.condvarany">[thread.condition.condvarany]</a>, 
paragraph 16, as indicated:</i></p>
<blockquote>

<p><i>Throws:</i> <code>std::system_error</code> when <del>the returned value, effects, or 
postcondition cannot be achieved</del> <ins>an exception is required (32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>)</ins>.</p>
</blockquote>

<p><i>Assuming issue <a href="lwg-defects.html#859" title="Monotonic Clock is Conditionally Supported? (Status: C++11)">859</a><sup><a href="https://cplusplus.github.io/LWG/issue859" title="Latest snapshot">(i)</a></sup>, Monotonic Clock is Conditionally Supported?, has been 
applied to the working paper, change Change 32.7.4 <a href="https://wg21.link/thread.condition.condvar">[thread.condition.condvar]</a> as 
indicated:</i></p>
<blockquote>
<pre>template &lt;class Rep, class Period&gt; 
bool wait_for(unique_lock&lt;mutex&gt;&amp; lock, 
              const chrono::duration&lt;Rep, Period&gt;&amp; rel_time);</pre>
<pre>...</pre>

<p><i>Throws:</i> <code>std::system_error</code> when <del>the effects or 
postcondition cannot be achieved</del> <ins>an exception is required ([thread.req.exception])</ins>.</p>
</blockquote>

<p><i>Assuming issue <a href="lwg-defects.html#859" title="Monotonic Clock is Conditionally Supported? (Status: C++11)">859</a><sup><a href="https://cplusplus.github.io/LWG/issue859" title="Latest snapshot">(i)</a></sup>, Monotonic Clock is Conditionally Supported?, has been 
applied to the working paper, change Change 32.7.4 <a href="https://wg21.link/thread.condition.condvar">[thread.condition.condvar]</a> as 
indicated:</i></p>
<blockquote>
<pre>template &lt;class Rep, class Period, class Predicate&gt; 
  bool wait_for(unique_lock&lt;mutex&gt;&amp; lock, 
                const chrono::duration&lt;Rep, Period&gt;&amp; rel_time, 
                Predicate pred);</pre>
  <pre>...</pre>

<p><i>Throws:</i> <code>std::system_error</code> when <del>the effects or 
postcondition cannot be achieved</del> <ins>an exception is required (32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>)</ins>.</p>
</blockquote>

<p><i>Assuming issue <a href="lwg-defects.html#859" title="Monotonic Clock is Conditionally Supported? (Status: C++11)">859</a><sup><a href="https://cplusplus.github.io/LWG/issue859" title="Latest snapshot">(i)</a></sup>, Monotonic Clock is Conditionally Supported?, has been 
applied to the working paper, change 32.7.5 <a href="https://wg21.link/thread.condition.condvarany">[thread.condition.condvarany]</a> as 
indicated:</i></p>
<blockquote>
<pre>template &lt;class Lock, class Rep, class Period&gt; 
  bool wait_for(Lock&amp; lock, const chrono::duration&lt;Rep, Period&gt;&amp; rel_time);</pre>
  <pre>...</pre>

<p><i>Throws:</i> <code>std::system_error</code> when <del>the returned value, effects or 
postcondition cannot be achieved</del> <ins>an exception is required (32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>)</ins>.</p>
</blockquote>

<p><i>Assuming issue <a href="lwg-defects.html#859" title="Monotonic Clock is Conditionally Supported? (Status: C++11)">859</a><sup><a href="https://cplusplus.github.io/LWG/issue859" title="Latest snapshot">(i)</a></sup>, Monotonic Clock is Conditionally Supported?, has been 
applied to the working paper, change 32.7.5 <a href="https://wg21.link/thread.condition.condvarany">[thread.condition.condvarany]</a> as 
indicated:</i></p>
<blockquote>
<pre>template &lt;class Lock, class Rep, class Period, class Predicate&gt; 
  bool wait_for(Lock&amp; lock, const chrono::duration&lt;Rep, Period&gt;&amp; rel_time, Predicate pred);</pre>
  <pre>...</pre>

<p><i>Throws:</i> <code>std::system_error</code> when <del>the returned value, effects or 
postcondition cannot be achieved</del> <ins>an exception is required (32.2.2 <a href="https://wg21.link/thread.req.exception">[thread.req.exception]</a>)</ins>.</p>
</blockquote>






</body>
</html>
