|
Boost-Commit : |
From: bdawes_at_[hidden]
Date: 2007-12-01 21:43:27
Author: bemandawes
Date: 2007-12-01 21:43:26 EST (Sat, 01 Dec 2007)
New Revision: 41564
URL: http://svn.boost.org/trac/boost/changeset/41564
Log:
Provide a definition of not-a-thread, and apply other changes to correct id related boo-boos.
Text files modified:
sandbox/committee/LWG/Pete_comments.html | 14 ++++++---
sandbox/committee/LWG/thread_library.html | 59 ++++++++++++++++++++++-----------------
2 files changed, 42 insertions(+), 31 deletions(-)
Modified: sandbox/committee/LWG/Pete_comments.html
==============================================================================
--- sandbox/committee/LWG/Pete_comments.html (original)
+++ sandbox/committee/LWG/Pete_comments.html 2007-12-01 21:43:26 EST (Sat, 01 Dec 2007)
@@ -44,6 +44,9 @@
<li>✔ thread::get_id() for a default-constructed thread returns an object that
refers to "not any thread". That last term isn't used anywhere else, so
shouldn't be used.<br>
+ <br>
+ <i>Extensive rewording to clarify class id related issues, and provide a
+ definition of "not a thread", which is now used in several places.</i><br>
</li>
<li>✔ Default constructor for thread constructs an object that is not "attached"
to any thread; other constructors create objects that "represent" a thread.
@@ -54,10 +57,8 @@
<li>✔ Template constructor for thread: "if f is an rvalue, F must only be
MoveConstructible". Does this mean that F must not be CopyConstructible?<br>
<br>
- <i>I changed both sentences to: "If <tt>f</tt> is an lvalue, <tt>F</tt> is <tt>CopyConstructible</tt>.
-If <tt>f</tt> is an rvalue, <tt>F</tt> is <tt>MoveConstructible</tt>."
- <span style="background-color: #FFFF00">Howard, please verify that's the
- intended meaning.</span></i><br>
+ <i>Changed both sentences to: "If <tt>f</tt> is an lvalue, <tt>F</tt> is <tt>CopyConstructible</tt>.
+If <tt>f</tt> is an rvalue, <tt>F</tt> is <tt>MoveConstructible</tt>."</i><br>
</li>
<li>✔ Thread::join "may throw system_error". Under what circumstances?<br>
<br>
@@ -203,7 +204,10 @@
<br>
The definition of "mutex" under condition_variable_any is (and should be)
quite fuzzy! Perhaps this precondition should simply be removed from
- condition_variable_any::wait? (Added by Howard.)</li>
+ condition_variable_any::wait? (Added by Howard.)<br>
+ </li>
+ <li>The term "block" is used a number of times, but is not defined either in
+ this proposal or in the current working paper. (Added by Beman).</li>
</ol>
</body>
Modified: sandbox/committee/LWG/thread_library.html
==============================================================================
--- sandbox/committee/LWG/thread_library.html (original)
+++ sandbox/committee/LWG/thread_library.html 2007-12-01 21:43:26 EST (Sat, 01 Dec 2007)
@@ -377,12 +377,19 @@
<h4><a name="thread.threads.class">30.1.1 Class thread [thread.threads.class]</a></h4>
<p>
-An object of class <code>thread</code> represents and manages a thread.
+An object of class <code>thread</code> represents and manages a thread of
+execution ([intro.multithread]).
It provides a mechanism to create a new thread,
for the current thread to wait for
completion of a thread,
-and to perform other operations to manage and query the state of the thread.
-</p>
+and to perform other operations to manage and query the state of the thread.
+Objects of type <code>thread</code> can only represent joinable threads of
+execution or <b><i>not a thread</i></b> (referred to as <b><i>NAT</i></b>). <i>
+[Note: </i>Once a program calls a <code>thread</code> object's <code>join()</code>
+or <code>detach()</code> members, or moves from a <code>thread</code> object,
+then that <code>thread</code> object no longer represents a thread of execution.
+Such a <code>thread</code> object represents NAT. Default constructed <code>thread</code>
+objects also represent NAT.<i> -- end note]</i></p>
<blockquote>
<pre><code>
@@ -448,12 +455,14 @@
</blockquote>
<p>
-Objects of type <code>thread::id</code> represent the identity of threads.
-Each
-joinable thread has a unique identity.
-All non-joinable threads share the same
-identity, and this identify is different from that of any joinable thread.
-</p>
+An object of type <code>thread::id</code> provides either a unique identity for
+a thread of execution or a NAT value ([thread.threads.class]). Each <code>thread</code>
+object, other than a NAT <code>thread</code> object, has a <code>thread::id</code>
+that compares not equal to the <code>thread::id</code> of all other <code>thread</code>
+objects, including NAT <code>thread</code> objects. The <code>thread::id</code>'s
+for all NAT <code>thread</code> objects compare equal to each other, and compare
+not equal to the <code>thread::id</code>'s of all <code>thread</code> objects
+not representing NAT.</p>
<p>
[<i>Note:</i>
@@ -480,8 +489,7 @@
<dt>Postconditions:</dt>
<dd>
-Represents the non-joinable identity.
-</dd>
+The constructed object has the NAT value.</dd>
</dl>
</blockquote>
@@ -532,7 +540,7 @@
<dl>
<dt>Returns:</dt>
<dd>
-a value such that <code>operator<</code>
+A value such that <code>operator<</code>
is a total ordering as described in [alg.sorting].
</dd>
@@ -628,8 +636,7 @@
<dl>
<dt>Effects:</dt>
<dd>
-Constructs a <code>thread</code> object that does not represent an
-actual thread.
+Constructs a <code>thread</code> object that represents NAT.
</dd>
<dt>Postconditions:</dt>
@@ -718,7 +725,8 @@
<dd>
<code><var>x</var>.joinable() == false</code>
<br>
-<code><var>x</var>.get_id() == thread().get_id()</code>. <code>joinable()</code>
+<code><var>x</var>.get_id() == thread().get_id()</code>.<br>
+<code>joinable()</code>
returns the value of <code><var>x</var>.joinable()</code>
prior to the start of construction.
<br>
@@ -765,7 +773,8 @@
<dl>
<dt>Effects:</dt>
<dd>
-If <code>this</code> currently represents a <code>joinable</code> thread object,
+If
+<code>joinable()</code>,
calls
<code>detach()</code>.
Then assigns the state of <code><var>x</var></code> to <code>*this</code>
@@ -776,7 +785,10 @@
<dd>
<code><var>x</var>.joinable() == false</code>
<br>
-<code><var>x</var>.get_id() == thread().get_id()</code>. <code>joinable()</code> returns the
+<code><var>x</var>.get_id() == thread().get_id()</code>.</dd>
+
+<dd>
+<code>joinable()</code> returns the
value of <code><var>x</var>.joinable()</code> prior to the
assignment.
<br>
@@ -850,12 +862,9 @@
<dt>Postconditions:</dt>
<dd>
-After a normal return of <code>join()</code>,
-<code>joinable()</code> is <code>false</code>.
-<br>
If <code>join()</code> throws an exception,
-the <code>joinable()</code> status remains unchanged.
-</dd>
+the <code>joinable()</code> status remains unchanged. Otherwise,
+<code>joinable()</code> is <code>false</code> and <code>get_id() == id()</code>.</dd>
<dt>Throws:</dt>
<dd>
@@ -888,8 +897,7 @@
<dd>
<code>joinable() == false</code>
<br>
-<code>*this</code>
-does not represent a thread.
+<code>get_id() == id()</code>.
</dd>
<dt>Throws:</dt>
@@ -2087,8 +2095,7 @@
<code>*this</code> and <code><var>u</var></code>
own the same mutex before the assignment.
In this case, <code>*this</code> will own the mutex after the assignment (and
-<code><var>u</var></code> will not), and the mutex will have one less level of
-recursion.
+<code><var>u</var></code> will not).
—<i>end note</i>] </p>
</blockquote>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk