|
Boost-Commit : |
From: anthony_at_[hidden]
Date: 2007-12-09 16:03:40
Author: anthonyw
Date: 2007-12-09 16:03:40 EST (Sun, 09 Dec 2007)
New Revision: 41938
URL: http://svn.boost.org/trac/boost/changeset/41938
Log:
Made changes to timed_mutex in line with changes to mutex
Text files modified:
sandbox/committee/LWG/thread_library.html | 73 +++++++++++++++++++++++++++++++++------
1 files changed, 62 insertions(+), 11 deletions(-)
Modified: sandbox/committee/LWG/thread_library.html
==============================================================================
--- sandbox/committee/LWG/thread_library.html (original)
+++ sandbox/committee/LWG/thread_library.html 2007-12-09 16:03:40 EST (Sun, 09 Dec 2007)
@@ -1594,8 +1594,6 @@
<dl>
<dt>Precondition:</dt>
<dd>
-For non-recursive mutexes the current thread shall not own
-the mutex.
If the resolution of <code>Duration</code>
is finer than the native resolution,
the time is rounded up to the nearest native resolution.
@@ -1605,7 +1603,7 @@
<dd>
The function attempts to obtain ownership of the mutex
within the specified time.
-If the indicated time is less than or equal to <code>0</code>,
+If the indicated time duration is less than or equal to <code>0</code>,
the function still attempts to obtain ownership without
blocking (as if by calling <code>try_lock()</code>).
If the function returns within the specified time duration,
@@ -1649,10 +1647,6 @@
<blockquote>
<dl>
-<dt>Precondition:</dt>
-<dd>
-For non-recursive mutexes the current thread shall not own the mutex.
-</dd>
<dt>Effects:</dt>
<dd>
@@ -1725,11 +1719,32 @@
</blockquote>
<p>
-The class <code>timed_mutex</code> provides a non-recursive mutex type
-that satisfies all of the TimedMutex requirements.
+The class <code>timed_mutex</code> provides a non-recursive mutex with exclusive ownership semantics.
+It satisfies all of the TimedMutex requirements [thread.timedmutex.requirements].
It shall be a standard-layout class (chapter 9 [class]).
</p>
+<p>
+If one thread owns the <code>timed_mutex</code> object, attempts by another thread to
+acquire ownership will fail (for <code>try_lock()</code>) or block (<code>for
+lock()</code> and <code>timed_lock()</code>) until the first thread has released ownership with a call to
+<code>unlock()</code>, or the call to <code>timed_lock()</code> times out (having failed to obtain ownership).
+</p>
+
+<p>
+It is undefined behavior:
+</p>
+
+<ul>
+<li>for a thread to call <code>lock()</code>, <code>try_lock()</code> or either overload of <code>timed_lock</code> if it
+already owns the <code>timed_mutex</code> object.
+</li>
+<li>if a thread terminates while owning a <code>timed_mutex</code> object.
+</li>
+<li>to destroy a <code>timed_mutex</code> object owned by any thread.
+</li>
+</ul>
+
<h5><a name="thread.timed.recursive">30.3.2.2 Class recursive_timed_mutex [thread.timed.recursive]</a></h5>
<blockquote>
@@ -1761,11 +1776,47 @@
</blockquote>
<p>
-The class <code>recursive_timed_mutex</code> provides a recursive mutex type
-that satisfies all of the TimedMutex requirements.
+The class <code>recursive_timed_mutex</code> provides a recursive mutex with exclusive ownership semantics.
+It satisfies all of the TimedMutex requirements ([thread.timedmutex.requirements]).
It shall be a standard-layout class (chapter 9 [class]).
</p>
+<p>
+If one thread owns the <code>recursive_timed_mutex</code> object, attempts by another
+thread to acquire ownership will fail (for <code>try_lock()</code>) or block
+(for <code>lock()</code> or <code>timed_lock()</code>) until the first thread has completely released
+ownership, or the call to <code>timed_lock()</code> times out (having failed to obtain ownership).
+</p>
+
+<p>
+A thread that owns a <code>recursive_timed_mutex</code> object
+may acquire additional levels of ownership
+by calling <code>lock()</code>, <code>try_lock()</code> or <code>timed_lock()</code>.
+It is unspecified how many levels of ownership
+may be acquired by a single thread.
+If a thread has already acquired the maximum level of ownership
+for a <code>recursive_timed_mutex</code> object,
+additional calls to <code>try_lock()</code> or <code>timed_lock()</code> shall fail,
+and additional calls to <code>lock()</code> shall throw an exception
+of type <code>system_error</code>.
+A thread must call <code>unlock()</code> once
+for each level of ownership acquired by calls
+to <code>lock()</code>, <code>try_lock()</code> and <code>timed_lock()</code>.
+Only when all levels of ownership have been released
+may ownership be acquired by another thread.
+</p>
+
+<p>
+It is undefined behavior
+</p>
+
+<ul>
+<li>if a thread terminates while owning a <code>recursive_timed_mutex</code> object.
+</li>
+<li>to destroy a <code>recursive_timed_mutex</code> object owned by any thread.
+</li>
+</ul>
+
<h4><a name="thread.lock.intro">30.3.3 Locks [thread.lock.intro]</a></h4>
<p>
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