Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85847 - in trunk/boost/sync: . detail/event
From: tim_at_[hidden]
Date: 2013-09-23 04:39:02


Author: timblechmann
Date: 2013-09-23 04:39:02 EDT (Mon, 23 Sep 2013)
New Revision: 85847
URL: http://svn.boost.org/trac/boost/changeset/85847

Log:
sync: document semantics of memory ordering

Text files modified:
   trunk/boost/sync/detail/event/event_mach.hpp | 1 -
   trunk/boost/sync/event.hpp | 10 ++++++++--
   trunk/boost/sync/semaphore.hpp | 10 ++++++++++
   3 files changed, 18 insertions(+), 3 deletions(-)

Modified: trunk/boost/sync/detail/event/event_mach.hpp
==============================================================================
--- trunk/boost/sync/detail/event/event_mach.hpp Mon Sep 23 04:03:14 2013 (r85846)
+++ trunk/boost/sync/detail/event/event_mach.hpp 2013-09-23 04:39:02 EDT (Mon, 23 Sep 2013) (r85847)
@@ -1,4 +1,3 @@
-
 // event.hpp, mach events
 //
 // Copyright (C) 2013 Tim Blechmann

Modified: trunk/boost/sync/event.hpp
==============================================================================
--- trunk/boost/sync/event.hpp Mon Sep 23 04:03:14 2013 (r85846)
+++ trunk/boost/sync/event.hpp 2013-09-23 04:39:02 EDT (Mon, 23 Sep 2013) (r85847)
@@ -37,7 +37,7 @@
     /**
      * \b Effects: Signals the event object: the event is set and waiting threads will be woken up.
      *
- * \b Precondition: No thread waits on this event.
+ * \b Memory Ordering: release
      *
      * \b Throws: if an error occurs.
      */
@@ -46,7 +46,7 @@
     /**
      * \b Effects: Waits for the event to be signaled. If the event is created as `auto_reset`, it will unset the `signaled` state
      *
- * \b Precondition: No thread waits on this event.
+ * \b Memory Ordering: acquire
      *
      * \b Throws: if an error occurs.
      */
@@ -62,6 +62,8 @@
     /**
      * \b Effects: Waits for the event to be signaled. If the event is created as `auto_reset`, it will unset the `signaled` state
      *
+ * \b Memory Ordering: acquire, if successful, relaxed otherwise
+ *
      * \b Returns: True if the event had been signaled, False, if the call would be blocking or the event has not been signaled.
      *
      * \b Throws: if an error occurs.
@@ -71,6 +73,8 @@
     /**
      * \b Effects: Waits for the event to be signaled. If the event is created as `auto_reset`, it will unset the `signaled` state
      *
+ * \b Memory Ordering: acquire, if successful, relaxed otherwise
+ *
      * \b Returns: True if the event had been signaled, False, if the call would be blocking or the event has not been signaled.
      *
      * \b Throws: if an error occurs.
@@ -81,6 +85,8 @@
     /**
      * \b Effects: Waits for the event to be signaled. If the event is created as `auto_reset`, it will unset the `signaled` state
      *
+ * \b Memory Ordering: acquire, if successful, relaxed otherwise
+ *
      * \b Returns: True if the event had been signaled, False, if the call would be blocking or the event has not been signaled.
      *
      * \b Throws: if an error occurs.

Modified: trunk/boost/sync/semaphore.hpp
==============================================================================
--- trunk/boost/sync/semaphore.hpp Mon Sep 23 04:03:14 2013 (r85846)
+++ trunk/boost/sync/semaphore.hpp 2013-09-23 04:39:02 EDT (Mon, 23 Sep 2013) (r85847)
@@ -39,6 +39,8 @@
     /**
      * \b Effects: Increments the semaphore count. If there are processes/threads blocked waiting for the semaphore, then one of these processes will return successfully from its wait function.
      *
+ * \b Memory Ordering: release
+ *
      * \b Throws: if an error occurs.
      * */
     void post();
@@ -46,6 +48,8 @@
     /**
      * \b Effects: Decrements the semaphore. If the semaphore value is not greater than zero, then the calling process/thread blocks until it can decrement the counter.
      *
+ * \b Memory Ordering: acquire
+ *
      * \b Throws: if an error occurs.
      * */
     void wait();
@@ -53,6 +57,8 @@
     /**
      * \b Effects: Decrements the semaphore if the semaphore's value is greater than zero and returns true. If the value is not greater than zero returns false.
      *
+ * \b Memory Ordering: acquire, if successful, relaxed otherwise
+ *
      * \b Throws: if an error occurs.
      * */
     bool try_wait();
@@ -60,6 +66,8 @@
     /**
      * \b Effects: Decrements the semaphore if the semaphore's value is greater than zero and returns true. Otherwise, waits for the semaphore to the posted or the timeout expires. If the timeout expires, the function returns false. If the semaphore is posted the function returns true.
      *
+ * \b Memory Ordering: acquire, if successful, relaxed otherwise
+ *
      * \b Throws: if an error occurs.
      * */
     template <class Duration>
@@ -68,6 +76,8 @@
     /**
      * \b Effects: Decrements the semaphore if the semaphore's value is greater than zero and returns true. Otherwise, waits for the semaphore to the posted or the timeout expires. If the timeout expires, the function returns false. If the semaphore is posted the function returns true.
      *
+ * \b Memory Ordering: acquire, if successful, relaxed otherwise
+ *
      * \b Throws: if an error occurs.
      * */
     template <class TimePoint>


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