Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

strand

Typedef for backwards compatibility.

typedef boost::asio::io_service::strand strand;
Member Functions

Name

Description

dispatch

Request the strand to invoke the given handler.

get_io_service

Get the io_service associated with the strand.

post

Request the strand to invoke the given handler and return immediately.

strand

Constructor.

wrap

Create a new handler that automatically dispatches the wrapped handler on the strand.

~strand

Destructor.

The io_service::strand class provides the ability to post and dispatch handlers with the guarantee that none of those handlers will execute concurrently.

Order of handler invocation

Given:

if any of the following conditions are true:

then asio_handler_invoke(a1, &a1) happens-before asio_handler_invoke(b1, &b1).

Note that in the following case:

async_op_1(..., s.wrap(a));
async_op_2(..., s.wrap(b));

the completion of the first async operation will perform s.dispatch(a), and the second will perform s.dispatch(b), but the order in which those are performed is unspecified. That is, you cannot state whether one happens-before the other. Therefore none of the above conditions are met and no ordering guarantee is made.

Thread Safety

Distinct objects: Safe.

Shared objects: Safe.

Requirements

Header: boost/asio/strand.hpp

Convenience header: boost/asio.hpp


PrevUpHomeNext