Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84980 - trunk/libs/thread/doc
From: vicente.botet_at_[hidden]
Date: 2013-07-07 16:50:14


Author: viboes
Date: 2013-07-07 16:50:14 EDT (Sun, 07 Jul 2013)
New Revision: 84980
URL: http://svn.boost.org/trac/boost/changeset/84980

Log:
Thread: update doc for latches, future continuations.

Text files modified:
   trunk/libs/thread/doc/changes.qbk | 22 +++++---------
   trunk/libs/thread/doc/future_ref.qbk | 4 +-
   trunk/libs/thread/doc/futures.qbk | 31 +++++++++----------
   trunk/libs/thread/doc/latch.qbk | 61 +++++++++++++++++++++++++++------------
   trunk/libs/thread/doc/sync_streams.qbk | 19 +++++++-----
   trunk/libs/thread/doc/synchronized_value.qbk | 2
   trunk/libs/thread/doc/thread.qbk | 6 +-
   7 files changed, 82 insertions(+), 63 deletions(-)

Modified: trunk/libs/thread/doc/changes.qbk
==============================================================================
--- trunk/libs/thread/doc/changes.qbk Sun Jul 7 16:44:02 2013 (r84979)
+++ trunk/libs/thread/doc/changes.qbk 2013-07-07 16:50:14 EDT (Sun, 07 Jul 2013) (r84980)
@@ -8,23 +8,24 @@
 
 [section:changes History]
 
-[/
+[/]
 [heading Version 4.2.0 - boost 1.55]
 
 [*New Features:]
 
-* [@http://svn.boost.org/trac/boost/ticket/8273 #8273] Synchro:Add externally locked streams.
-* [@http://svn.boost.org/trac/boost/ticket/8274 #8274] Synchro:Add concurrent queue.
-* [@http://svn.boost.org/trac/boost/ticket/8515 #8515] Async: Add shared_future::then.
+* [@http://svn.boost.org/trac/boost/ticket/8274 #8274] Synchro: Add concurrent queue
 * [@http://svn.boost.org/trac/boost/ticket/8518 #8518] Synchro: Add a latch class.
+* [@http://svn.boost.org/trac/boost/ticket/8519 #8519] Synchro: Update class barrier with a completion function.
+
 * [@http://svn.boost.org/trac/boost/ticket/8615 #8615] Async: Replace make_future/make_shared_future by make_ready_future.
-* [@http://svn.boost.org/trac/boost/ticket/8627 #8627] Async: Add future<>::unwrap.
+* [@http://svn.boost.org/trac/boost/ticket/8515 #8515] Async: Add shared_future::then.
+* [@http://svn.boost.org/trac/boost/ticket/8627 #8627] Async: Add future<>::unwrap and unwrapping constructor.
 * [@http://svn.boost.org/trac/boost/ticket/8677 #8677] Async: Add future<>::get_or.
 * [@http://svn.boost.org/trac/boost/ticket/8678 #8678] Async: Add future<>::fallback_to.
 
 [*Fixed Bugs:]
 
-]
+[/]
 
 [heading Version 4.1.0 - boost 1.54]
 
@@ -416,10 +417,7 @@
   * [@http://svn.boost.org/trac/boost/ticket/7589 #7589] Synchro: Add polymorphic lockables.
 
 # Add some features based on C++ proposals, in particular
- * [@http://svn.boost.org/trac/boost/ticket/8273 #8273] Add externally locked streams
- * [@http://svn.boost.org/trac/boost/ticket/8274 #8274] Add concurrent queue
- * [@http://svn.boost.org/trac/boost/ticket/8518 #8518] Sync: Add a latch class
- * [@http://svn.boost.org/trac/boost/ticket/8519 #8519] Sync: Add a completion_latch class
+ * [@http://svn.boost.org/trac/boost/ticket/8273 #8273] Synchro: Add externally locked streams.
   * [@http://svn.boost.org/trac/boost/ticket/8513 #8513] Async: Add a basic thread_pool executor.
   * [@http://svn.boost.org/trac/boost/ticket/8514 #8514] Async: Add a thread_pool executor with work stealing.
 
@@ -428,14 +426,10 @@
   * [@http://svn.boost.org/trac/boost/ticket/7446 #7446] Async: Add when_any.
   * [@http://svn.boost.org/trac/boost/ticket/7447 #7447] Async: Add when_all.
   * [@http://svn.boost.org/trac/boost/ticket/7448 #7448] Async: Add async taking a scheduler parameter.
- * [@http://svn.boost.org/trac/boost/ticket/8515 #8515] Async: Add shared_future::then.
   * [@http://svn.boost.org/trac/boost/ticket/8516 #8516] Async: Add future/shared_future::then taking a scheduler as parameter.
- * [@http://svn.boost.org/trac/boost/ticket/8627 #8627] Async: Add future<>::unwrap.
 
 # And some additional extensions related to futures as:
 
- * [@http://svn.boost.org/trac/boost/ticket/8677 #8677] Async: Add future<>::get_or.
- * [@http://svn.boost.org/trac/boost/ticket/8678 #8678] Async: Add future<>::fallback_to.
   * [@http://svn.boost.org/trac/boost/ticket/8517 #8517] Async: Add a variadic shared_future::then.
 
 

Modified: trunk/libs/thread/doc/future_ref.qbk
==============================================================================
--- trunk/libs/thread/doc/future_ref.qbk Sun Jul 7 16:44:02 2013 (r84979)
+++ trunk/libs/thread/doc/future_ref.qbk 2013-07-07 16:50:14 EDT (Sun, 07 Jul 2013) (r84980)
@@ -836,7 +836,7 @@
 
 ]]
 
-[[Returns:] [An object of type `__unique_future__<typename boost::result_of<F(__unique_future__&)>` that refers to the shared state created by the continuation.]]
+[[Returns:] [An object of type `__unique_future__<typename boost::result_of<F(__unique_future__)>` that refers to the shared state created by the continuation.]]
 
 [[Postconditions:] [
 
@@ -1282,7 +1282,7 @@
 
 ]]
 
-[[Returns:] [An object of type `__unique_future__<typename boost::result_of<F(shared_future&)>` that refers to the shared state created by the continuation.]]
+[[Returns:] [An object of type `__unique_future__<typename boost::result_of<F(shared_future)>` that refers to the shared state created by the continuation.]]
 
 [[Postconditions:] [
 

Modified: trunk/libs/thread/doc/futures.qbk
==============================================================================
--- trunk/libs/thread/doc/futures.qbk Sun Jul 7 16:44:02 2013 (r84979)
+++ trunk/libs/thread/doc/futures.qbk 2013-07-07 16:50:14 EDT (Sun, 07 Jul 2013) (r84980)
@@ -404,16 +404,16 @@
 
 In asynchronous programming, it is very common for one asynchronous operation, on completion, to invoke a second
 operation and pass data to it. The current C++ standard does not allow one to register a continuation to a future.
-With .then, instead of waiting for the result, a continuation is "attached" to the asynchronous operation, which is
-invoked when the result is ready. Continuations registered using the .then function will help to avoid blocking waits
+With `.then`, instead of waiting for the result, a continuation is "attached" to the asynchronous operation, which is
+invoked when the result is ready. Continuations registered using the `.then` function will help to avoid blocking waits
 or wasting threads on polling, greatly improving the responsiveness and scalability of an application.
 
-future.then provides the ability to sequentially compose two futures by declaring one to be the continuation of another.
-With .then the antecedent future is ready (has a value or exception stored in the shared state) before the continuation
+`future.then()` provides the ability to sequentially compose two futures by declaring one to be the continuation of another.
+With `.then()` the antecedent future is ready (has a value or exception stored in the shared state) before the continuation
 starts as instructed by the lambda function.
 
-In the example below the future<int> f2 is registered to be a continuation of future<int> f1 using the .then member
-function. This operation takes a lambda function which describes how f2 should proceed after f1 is ready.
+In the example below the `future<int>` `f2` is registered to be a continuation of `future<int>` `f1` using the `.then()` member
+function. This operation takes a lambda function which describes how `f2` should proceed after `f1` is ready.
 
 
   #include <boost/thread/future.hpp>
@@ -426,7 +426,7 @@
 
 One key feature of this function is the ability to chain multiple asynchronous operations. In asynchronous programming,
 it's common to define a sequence of operations, in which each continuation executes only when the previous one completes.
-In some cases, the antecedent future produces a value that the continuation accepts as input. By using future.then,
+In some cases, the antecedent future produces a value that the continuation accepts as input. By using `future.then()`,
 creating a chain of continuations becomes straightforward and intuitive:
 
   myFuture.then(...).then(...).then(...).
@@ -439,21 +439,20 @@
 
 Input Parameters:
 
-* Lambda function2: One option which was considered was to follow JavaScript's approach and take two functions, one for
-success and one for error handling. However this option is not viable in C++ as there is no single base type for
-exceptions as there is in JavaScript. The lambda function takes a future as its input which carries the exception
+* Lambda function: One option which can be considered is to take two functions, one for
+success and one for error handling. However this option has not been retained for the moment.
+The lambda function takes a future as its input which carries the exception
 through. This makes propagating exceptions straightforward. This approach also simplifies the chaining of continuations.
-* Scheduler: Providing an overload to .then, to take a scheduler reference places great flexibility over the execution
+* Scheduler: Providing an overload to `.then`, to take a scheduler reference places great flexibility over the execution
 of the future in the programmer's hand. As described above, often taking a launch policy is not sufficient for powerful
 asynchronous operations. The lifetime of the scheduler must outlive the continuation.
 * Launch policy: if the additional flexibility that the scheduler provides is not required.
 
-
 Return values: The decision to return a future was based primarily on the ability to chain multiple continuations using
-.then. This benefit of composability gives the programmer incredible control and flexibility over their code. Returning
-a future object rather than a shared_future is also a much cheaper operation thereby improving performance. A
-shared_future object is not necessary to take advantage of the chaining feature. It is also easy to go from a future
-to a shared_future when needed using future::share().
+`.then()`. This benefit of composability gives the programmer incredible control and flexibility over their code. Returning
+a `future` object rather than a `shared_future` is also a much cheaper operation thereby improving performance. A
+`shared_future` object is not necessary to take advantage of the chaining feature. It is also easy to go from a `future`
+to a `shared_future` when needed using future::share().
 
 
 [endsect]

Modified: trunk/libs/thread/doc/latch.qbk
==============================================================================
--- trunk/libs/thread/doc/latch.qbk Sun Jul 7 16:44:02 2013 (r84979)
+++ trunk/libs/thread/doc/latch.qbk 2013-07-07 16:50:14 EDT (Sun, 07 Jul 2013) (r84980)
@@ -7,13 +7,19 @@
 
 [section:latches Latches -- EXPERIMENTAL]
 
+[////////////////////]
 [section Introdcution]
 
-Latches are a thread co-ordination mechanism that allow one or more threads to block until one or more threads have reached a point. An individual latch is a reusable object; once the operation has been completed, the threads can re-use the same barrier. It is thus useful for managing repeated tasks handled by multiple threads.
+Latches are a thread co-ordination mechanism that allow one or more threads to block until one or more threads have reached a point.
+
+[/
+An individual latch is a reusable object; once the operation has been completed, the threads can re-use the same barrier. It is thus useful for managing repeated tasks handled by multiple threads.
 
 A completion latch is like a latch that allows to associate a completion function which will be called once the internal counter reaches the value 0 and all the consumer threads have taken care of the notification.
+]
 
 [endsect]
+[////////////////]
 [section Examples]
 
 Sample use cases for the latch include:
@@ -38,7 +44,6 @@
 
 An example of the second use case is shown below. We need to load data and then process it using a number of threads. Loading the data is I/O bound, whereas starting threads and creating data structures is CPU bound. By running these in parallel, throughput can be increased.
 
-
   void DoWork() {
     latch start_latch(1);
     vector<thread*> workers;
@@ -57,6 +62,7 @@
     start_latch.count_down();
     }
 
+[/
 The completion latches can be used to co-ordinate also a set of threads carrying out a repeated task. The number of threads can be adjusted dynamically to respond to changing requirements.
 
 In the example below, a number of threads are performing a multi-stage task. Some tasks may require fewer steps than others, meaning that some threads may finish before others. We reduce the number of threads waiting on the latch when this happens.
@@ -96,8 +102,10 @@
       GetNextStage(tasks);
     }
   }
+]
 
 [endsect]
+[///////////////////////////]
 [section:latch Class `latch`]
 
     #include <boost/thread/latch.hpp>
@@ -119,16 +127,20 @@
         cv_status wait_until(const chrono::time_point<Clock, Duration>& abs_time);
         void count_down();
         void count_down_and_wait();
- void reset(std::size_t count);
 
     };
 
 
+[/
+ void reset(std::size_t count);
+]
+
 A latch maintains an internal counter that is initialized when the latch is created. One or more threads may block waiting until the counter is decremented to 0.
 
 Instances of __latch__ are not copyable or movable.
 
-[section Constructor]
+[///////////////////]
+[section Constructor `latch(std::size_t)`]
 
     latch(std::size_t count);
 
@@ -136,14 +148,15 @@
 
 [[Effects:] [Construct a latch with is initial value for the internal counter.]]
 
-[[Note:] [The counter could be zero and reset later.]]
+[[Note:] [The counter could be zero.]]
 
 [[Throws:] [Nothing.]]
 
 ]
 
 [endsect]
-[section Destructor]
+[//////////////////]
+[section Destructor `~latch()`]
 
     ~latch();
 
@@ -158,7 +171,8 @@
 ]
 
 [endsect]
-[section:wait Member function `wait()`]
+[/////////////////////////////////////]
+[section:wait Member Function `wait()`]
 
     void wait();
 
@@ -178,8 +192,8 @@
 ]
 
 [endsect]
-
-[section:try_wait Member function `try_wait()`]
+[/////////////////////////////////////////////]
+[section:try_wait Member Function `try_wait()`]
 
         bool try_wait();
 
@@ -194,8 +208,8 @@
 ]
 
 [endsect]
-
-[section:wait_for Member function `wait_for() `]
+[//////////////////////////////////////////////]
+[section:wait_for Member Function `wait_for() `]
 
         template <class Rep, class Period>
         cv_status wait_for(const chrono::duration<Rep, Period>& rel_time);
@@ -216,7 +230,8 @@
 ]
 
 [endsect]
-[section:wait_until Member function `wait_until()`]
+[/////////////////////////////////////////////////]
+[section:wait_until Member Function `wait_until()`]
 
         template <class lock_type, class Clock, class Duration>
         cv_status wait_until(const chrono::time_point<Clock, Duration>& abs_time);
@@ -237,7 +252,8 @@
 ]
 
 [endsect]
-[section:count_down Member function `count_down()`]
+[/////////////////////////////////////////////////]
+[section:count_down Member Function `count_down()`]
 
         void count_down();
 
@@ -256,7 +272,8 @@
 ]
 
 [endsect]
-[section:count_down_and_wait Member function `count_down_and_wait()`]
+[///////////////////////////////////////////////////////////////////]
+[section:count_down_and_wait Member Function `count_down_and_wait()`]
 
         void count_down_and_wait();
 
@@ -275,8 +292,9 @@
 ]
 
 [endsect]
-
-[section:reset Member function `reset()`]
+[///////////////////////////////////////]
+[
+[section:reset Member Function `reset()`]
 
     reset( size_t );
 
@@ -293,9 +311,11 @@
 ]
 
 [endsect]
-
+]
 [endsect] [/ latch]
 
+[/
+[//////////////////////////////////////////////////]
 [section:completion_latch Class `completion_latch `]
 
     #include <boost/thread/completion_latch.hpp>
@@ -333,6 +353,7 @@
 
 Only the additional functions are documented.
 
+[/////////////////////]
 [section:c Constructor]
 
     completion_latch(std::size_t count);
@@ -348,6 +369,7 @@
 ]
 
 [endsect]
+[///////////////////////////////////////////////]
 [section:cf Constructor with completion function]
 
         template <typename F>
@@ -368,7 +390,8 @@
 ]
 
 [endsect]
-[section:then Member function `then`]
+[///////////////////////////////////]
+[section:then Member Function `then`]
 
         template <typename F>
         completion_function then(F&& funct);
@@ -391,6 +414,6 @@
 [endsect]
 
 [endsect] [/ completion_latch]
-
+]
 
 [endsect] [/ Latches]

Modified: trunk/libs/thread/doc/sync_streams.qbk
==============================================================================
--- trunk/libs/thread/doc/sync_streams.qbk Sun Jul 7 16:44:02 2013 (r84979)
+++ trunk/libs/thread/doc/sync_streams.qbk 2013-07-07 16:50:14 EDT (Sun, 07 Jul 2013) (r84980)
@@ -16,6 +16,7 @@
 
 [endsect] [/tutorial]
 
+[/////////////////////]
 [section:ref Reference]
 
   #include <boost/thread/externally_locked_stream.hpp>
@@ -48,7 +49,7 @@
     operator>>(externally_locked_stream<Stream, RecursiveMutex>& mtx, T& arg);
   }
 
-
+[/////////////////////////////////////////]
 [section:stream_guard Class `stream_guard`]
   
   #include <boost/thread/externally_locked_stream.hpp>
@@ -78,6 +79,7 @@
 
 `stream_guard` is a model of __StrictLock.
 
+[//////////////////////////////////////////////////]
 [section:constructor `stream_guard(mutex_type & m)`]
 
 [variablelist
@@ -89,7 +91,7 @@
 ]
 
 [endsect]
-
+[////////////////////////////////////////////////////////////////////////////]
 [section:constructor_adopt `stream_guard(mutex_type & m,boost::adopt_lock_t)`]
 
 [variablelist
@@ -105,8 +107,7 @@
 ]
 
 [endsect]
-
-
+[//////////////////////////////////////////////////////////]
 [section:move_constructor `stream_guard(stream_guard && m)`]
 
 
@@ -119,8 +120,7 @@
 ]
 
 [endsect]
-
-
+[////////////////////////////////////]
 [section:destructor `~stream_guard()`]
 
 [variablelist
@@ -134,8 +134,8 @@
 
 [endsect]
 
-
 [endsect]
+[//////////////////////////////////////////////////////////////////]
 [section:externally_locked_stream Class `externally_locked_stream `]
 
   #include <boost/thread/externally_locked_stream.hpp>
@@ -152,7 +152,6 @@
   
       // Modifiers
       stream_guard<Stream, RecursiveMutex> hold();
- Stream& bypass() const;
 
     };
   }
@@ -162,6 +161,7 @@
 pass a reference to a strict lock object.
 
 
+[////////////////////////////////////////////////////////////////////////]
 [section:constructor `externally_locked_stream(Stream&, RecursiveMutex&)`]
 
 [variablelist
@@ -172,6 +172,7 @@
 
 [endsect]
 
+[/////////////////////]
 [section:hold `hold()`]
 
 [variablelist
@@ -182,6 +183,8 @@
 
 [endsect]
 
+
+
 [endsect]
 
 

Modified: trunk/libs/thread/doc/synchronized_value.qbk
==============================================================================
--- trunk/libs/thread/doc/synchronized_value.qbk Sun Jul 7 16:44:02 2013 (r84979)
+++ trunk/libs/thread/doc/synchronized_value.qbk 2013-07-07 16:50:14 EDT (Sun, 07 Jul 2013) (r84980)
@@ -6,7 +6,7 @@
  /]
 
 
-[section:synchronized_valuesxxx Synchronized values - EXPERIMENTAL]
+[section:synchronized_valuesxxx Synchronized Values - EXPERIMENTAL]
 
 [warning These features are experimental and subject to change in future versions. There are not too much tests yet, so it is possible that you can find out some trivial bugs :(]
 

Modified: trunk/libs/thread/doc/thread.qbk
==============================================================================
--- trunk/libs/thread/doc/thread.qbk Sun Jul 7 16:44:02 2013 (r84979)
+++ trunk/libs/thread/doc/thread.qbk 2013-07-07 16:50:14 EDT (Sun, 07 Jul 2013) (r84980)
@@ -8,7 +8,7 @@
 
 [library Thread
     [quickbook 1.5]
- [version 4.1.0]
+ [version 4.2.0]
     [authors [Williams, Anthony] [Botet Escriba, Vicente J.]]
     [copyright 2007-11 Anthony Williams]
     [copyright 2011-13 Vicente J. Botet Escriba]
@@ -239,7 +239,7 @@
 [include condition_variables.qbk]
 [include once.qbk]
 [include barrier.qbk]
-[/include latch.qbk]
+[include latch.qbk]
 [include futures.qbk]
 [/include async_executors.qbk]
 [endsect]
@@ -249,7 +249,7 @@
 
 [section:sds Synchronized Data Structures]
 [include synchronized_value.qbk]
-[/include sync_queues_ref.qbk]
+[include sync_queues_ref.qbk]
 [/include sync_streams.qbk]
 [endsect]
 


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