Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85674 - trunk/boost/sync
From: tim_at_[hidden]
Date: 2013-09-15 07:05:46


Author: timblechmann
Date: 2013-09-15 07:05:46 EDT (Sun, 15 Sep 2013)
New Revision: 85674
URL: http://svn.boost.org/trac/boost/changeset/85674

Log:
sync: add doxygen documentation for semaphore

Text files modified:
   trunk/boost/sync/semaphore.hpp | 68 ++++++++++++++++++++++++++++++++++++++++
   1 files changed, 68 insertions(+), 0 deletions(-)

Modified: trunk/boost/sync/semaphore.hpp
==============================================================================
--- trunk/boost/sync/semaphore.hpp Sun Sep 15 06:46:54 2013 (r85673)
+++ trunk/boost/sync/semaphore.hpp 2013-09-15 07:05:46 EDT (Sun, 15 Sep 2013) (r85674)
@@ -9,6 +9,72 @@
 #ifndef BOOST_SYNC_SEMAPHORE_HPP
 #define BOOST_SYNC_SEMAPHORE_HPP
 
+#ifdef BOOST_SYNC_DETAIL_DOXYGEN
+
+namespace boost {
+namespace sync {
+
+class semaphore
+{
+ /**
+ * \b Effects: Constructs a semaphore object. The semaphore is initialized to `initial_count`, which is expected to be non-negative.
+ *
+ * \b Throws: if an error occurs.
+ *
+ * */
+ semaphore(int initial_count = 0);
+
+ /**
+ * \b Precondition: No thread is waiting on the semaphore
+ *
+ * \b Effects: Destroys the object
+ *
+ * */
+ ~semaphore();
+
+ /**
+ * \b Effects: Increments the semaphore count. If a thread is waiting for this semaphore, it will be unblocked.
+ *
+ * \b Throws: if an error occurs.
+ * */
+ void post();
+
+ /**
+ * \b Effects: If the semaphore count is positive, it atomically decrements it and returns. Otherwise blocks the current thread, until it can successfully decrement a positive semaphore count.
+ *
+ * \b Throws: if an error occurs.
+ * */
+ void wait();
+
+ /**
+ * \b Effects: If the semaphore count is positive, it atomically decrements it and returns `true`. Otherwise `false`.
+ *
+ * \b Throws: if an error occurs.
+ * */
+ bool try_wait();
+
+ /**
+ * \b Effects: If the semaphore count is positive, it atomically decrements it and returns `true`. Otherwise it waits for the semaphore for `duration`.
+ *
+ * \b Throws: if an error occurs.
+ * */
+ template <class Duration>
+ bool try_wait_for(const Duration & duration);
+
+ /**
+ * \b Effects: If the semaphore count is positive, it atomically decrements it and returns `true`. Otherwise it waits for the semaphore until `timeout`.
+ *
+ * \b Throws: if an error occurs.
+ * */
+ template <class TimePoint>
+ bool try_wait_until(const TimePoint & timeout);
+};
+
+
+}}
+
+#else
+
 #include <boost/sync/detail/config.hpp>
 
 #ifdef BOOST_HAS_PRAGMA_ONCE
@@ -35,4 +101,6 @@
 
 #include <boost/sync/detail/footer.hpp>
 
+#endif
+
 #endif // BOOST_THREAD_SEMAPHORE_HPP


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