Clementine
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
asio::executor Class Reference

Polymorphic wrapper for executors. More...

#include <executor.hpp>

Classes

class  impl< system_executor, Allocator >
 
struct  unspecified_bool_type_t
 

Public Types

typedef void(* unspecified_bool_type) (unspecified_bool_type_t)
 

Public Member Functions

 executor () ASIO_NOEXCEPT
 Default constructor.
 
 executor (nullptr_t) ASIO_NOEXCEPT
 Construct from nullptr.
 
 executor (const executor &other) ASIO_NOEXCEPT
 Copy constructor.
 
template<typename Executor >
 executor (Executor e)
 Construct a polymorphic wrapper for the specified executor.
 
template<typename Executor , typename Allocator >
 executor (allocator_arg_t, const Allocator &a, Executor e)
 Allocator-aware constructor to create a polymorphic wrapper for the specified executor. More...
 
 ~executor ()
 Destructor.
 
executoroperator= (const executor &other) ASIO_NOEXCEPT
 Assignment operator.
 
executoroperator= (nullptr_t) ASIO_NOEXCEPT
 Assignment operator for nullptr_t.
 
template<typename Executor >
executoroperator= (ASIO_MOVE_ARG(Executor) e) ASIO_NOEXCEPT
 Assignment operator to create a polymorphic wrapper for the specified executor. More...
 
execution_contextcontext () const ASIO_NOEXCEPT
 Obtain the underlying execution context.
 
void on_work_started () const ASIO_NOEXCEPT
 Inform the executor that it has some outstanding work to do.
 
void on_work_finished () const ASIO_NOEXCEPT
 Inform the executor that some work is no longer outstanding.
 
template<typename Function , typename Allocator >
void dispatch (ASIO_MOVE_ARG(Function) f, const Allocator &a) const
 Request the executor to invoke the given function object. More...
 
template<typename Function , typename Allocator >
void post (ASIO_MOVE_ARG(Function) f, const Allocator &a) const
 Request the executor to invoke the given function object. More...
 
template<typename Function , typename Allocator >
void defer (ASIO_MOVE_ARG(Function) f, const Allocator &a) const
 Request the executor to invoke the given function object. More...
 
 operator unspecified_bool_type () const ASIO_NOEXCEPT
 Operator to test if the executor contains a valid target.
 
const std::type_info & target_type () const ASIO_NOEXCEPT
 Obtain type information for the target executor object. More...
 
template<typename Executor >
Executor * target () ASIO_NOEXCEPT
 Obtain a pointer to the target executor object. More...
 
template<typename Executor >
const Executor * target () const ASIO_NOEXCEPT
 Obtain a pointer to the target executor object. More...
 

Static Public Member Functions

static void unspecified_bool_true (unspecified_bool_type_t)
 

Friends

bool operator== (const executor &a, const executor &b) ASIO_NOEXCEPT
 Compare two executors for equality.
 
bool operator!= (const executor &a, const executor &b) ASIO_NOEXCEPT
 Compare two executors for inequality.
 

Detailed Description

Polymorphic wrapper for executors.

Constructor & Destructor Documentation

◆ executor()

template<typename Executor , typename Allocator >
executor::executor ( allocator_arg_t  ,
const Allocator &  a,
Executor  e 
)

Allocator-aware constructor to create a polymorphic wrapper for the specified executor.

Member Function Documentation

◆ defer()

template<typename Function , typename Allocator >
void executor::defer ( ASIO_MOVE_ARG(Function)  f,
const Allocator &  a 
) const

Request the executor to invoke the given function object.

This function is used to ask the executor to execute the given function object. The function object is executed according to the rules of the target executor object.

Parameters
fThe function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
void function();
aAn allocator that may be used by the executor to allocate the internal storage needed for function invocation.

◆ dispatch()

template<typename Function , typename Allocator >
void executor::dispatch ( ASIO_MOVE_ARG(Function)  f,
const Allocator &  a 
) const

Request the executor to invoke the given function object.

This function is used to ask the executor to execute the given function object. The function object is executed according to the rules of the target executor object.

Parameters
fThe function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
void function();
aAn allocator that may be used by the executor to allocate the internal storage needed for function invocation.

◆ operator=()

template<typename Executor >
executor& asio::executor::operator= ( ASIO_MOVE_ARG(Executor)  e)
inline

Assignment operator to create a polymorphic wrapper for the specified executor.

◆ post()

template<typename Function , typename Allocator >
void executor::post ( ASIO_MOVE_ARG(Function)  f,
const Allocator &  a 
) const

Request the executor to invoke the given function object.

This function is used to ask the executor to execute the given function object. The function object is executed according to the rules of the target executor object.

Parameters
fThe function object to be called. The executor will make a copy of the handler object as required. The function signature of the function object must be:
void function();
aAn allocator that may be used by the executor to allocate the internal storage needed for function invocation.

◆ target() [1/2]

template<typename Executor >
Executor * executor::target ( )

Obtain a pointer to the target executor object.

Returns
If target_type() == typeid(T), a pointer to the stored executor target; otherwise, a null pointer.

◆ target() [2/2]

template<typename Executor >
const Executor * executor::target ( ) const

Obtain a pointer to the target executor object.

Returns
If target_type() == typeid(T), a pointer to the stored executor target; otherwise, a null pointer.

◆ target_type()

const std::type_info& asio::executor::target_type ( ) const
inline

Obtain type information for the target executor object.

Returns
If *this has a target type of type T, typeid(T); otherwise, typeid(void).

The documentation for this class was generated from the following file: