Skip to content

Commit

Permalink
Fix up dispatch() documentation. Clarify distinction between post() a…
Browse files Browse the repository at this point in the history
…nd defer().
  • Loading branch information
chriskohlhoff committed Mar 7, 2019
1 parent c7d4557 commit 45abc54
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
10 changes: 10 additions & 0 deletions asio/include/asio/defer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ namespace asio {
* executor. The function object is queued for execution, and is never called
* from the current thread prior to returning from <tt>defer()</tt>.
*
* The use of @c defer(), rather than @ref post(), indicates the caller's
* preference that the executor defer the queueing of the function object. This
* may allow the executor to optimise queueing for cases when the function
* object represents a continuation of the current call context.
*
* This function has the following effects:
*
* @li Constructs a function object handler of type @c Handler, initialized
Expand Down Expand Up @@ -59,6 +64,11 @@ ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer(
* The function object is queued for execution, and is never called from the
* current thread prior to returning from <tt>defer()</tt>.
*
* The use of @c defer(), rather than @ref post(), indicates the caller's
* preference that the executor defer the queueing of the function object. This
* may allow the executor to optimise queueing for cases when the function
* object represents a continuation of the current call context.
*
* This function has the following effects:
*
* @li Constructs a function object handler of type @c Handler, initialized
Expand Down
8 changes: 4 additions & 4 deletions asio/include/asio/dispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ namespace asio {
/// Submits a completion token or function object for execution.
/**
* This function submits an object for execution using the object's associated
* executor. The function object is queued for execution, and is never called
* from the current thread prior to returning from <tt>dispatch()</tt>.
* executor. The function object may be called from the current thread prior to
* returning from <tt>dispatch()</tt>. Otherwise, it is queued for execution.
*
* This function has the following effects:
*
Expand All @@ -56,8 +56,8 @@ ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch(
/// Submits a completion token or function object for execution.
/**
* This function submits an object for execution using the specified executor.
* The function object is queued for execution, and is never called from the
* current thread prior to returning from <tt>dispatch()</tt>.
* The function object may be called from the current thread prior to returning
* from <tt>dispatch()</tt>. Otherwise, it is queued for execution.
*
* This function has the following effects:
*
Expand Down
6 changes: 6 additions & 0 deletions asio/include/asio/post.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ namespace asio {
* executor. The function object is queued for execution, and is never called
* from the current thread prior to returning from <tt>post()</tt>.
*
* The use of @c post(), rather than @ref defer(), indicates the caller's
* preference that the function object be eagerly queued for execution.
*
* This function has the following effects:
*
* @li Constructs a function object handler of type @c Handler, initialized
Expand Down Expand Up @@ -59,6 +62,9 @@ ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) post(
* The function object is queued for execution, and is never called from the
* current thread prior to returning from <tt>post()</tt>.
*
* The use of @c post(), rather than @ref defer(), indicates the caller's
* preference that the function object be eagerly queued for execution.
*
* This function has the following effects:
*
* @li Constructs a function object handler of type @c Handler, initialized
Expand Down
12 changes: 10 additions & 2 deletions asio/src/doc/reference.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -58529,6 +58529,8 @@ Submits a completion token or function object for execution.

This function submits an object for execution using the object's associated executor. The function object is queued for execution, and is never called from the current thread prior to returning from `defer()`.

The use of `defer()`, rather than [link asio.reference.post `post`] , indicates the caller's preference that the executor defer the queueing of the function object. This may allow the executor to optimise queueing for cases when the function object represents a continuation of the current call context.

This function has the following effects:


Expand Down Expand Up @@ -58573,6 +58575,8 @@ Submits a completion token or function object for execution.

This function submits an object for execution using the specified executor. The function object is queued for execution, and is never called from the current thread prior to returning from `defer()`.

The use of `defer()`, rather than [link asio.reference.post `post`] , indicates the caller's preference that the executor defer the queueing of the function object. This may allow the executor to optimise queueing for cases when the function object represents a continuation of the current call context.

This function has the following effects:


Expand Down Expand Up @@ -58756,7 +58760,7 @@ Submits a completion token or function object for execution.
CompletionToken && token);


This function submits an object for execution using the object's associated executor. The function object is queued for execution, and is never called from the current thread prior to returning from `dispatch()`.
This function submits an object for execution using the object's associated executor. The function object may be called from the current thread prior to returning from `dispatch()`. Otherwise, it is queued for execution.

This function has the following effects:

Expand Down Expand Up @@ -58800,7 +58804,7 @@ Submits a completion token or function object for execution.
typename enable_if< is_executor< Executor >::value >::type * = 0);


This function submits an object for execution using the specified executor. The function object is queued for execution, and is never called from the current thread prior to returning from `dispatch()`.
This function submits an object for execution using the specified executor. The function object may be called from the current thread prior to returning from `dispatch()`. Otherwise, it is queued for execution.

This function has the following effects:

Expand Down Expand Up @@ -98100,6 +98104,8 @@ Submits a completion token or function object for execution.

This function submits an object for execution using the object's associated executor. The function object is queued for execution, and is never called from the current thread prior to returning from `post()`.

The use of `post()`, rather than [link asio.reference.defer `defer`] , indicates the caller's preference that the function object be eagerly queued for execution.

This function has the following effects:


Expand Down Expand Up @@ -98144,6 +98150,8 @@ Submits a completion token or function object for execution.

This function submits an object for execution using the specified executor. The function object is queued for execution, and is never called from the current thread prior to returning from `post()`.

The use of `post()`, rather than [link asio.reference.defer `defer`] , indicates the caller's preference that the function object be eagerly queued for execution.

This function has the following effects:


Expand Down

0 comments on commit 45abc54

Please sign in to comment.