Skip to content

asio::thread_pool::executor_type

Executor used to submit functions to a thread pool.

詳細情報

メンバー

context()

Obtain the underlying execution context.

thread_pool & asio::thread_pool::executor_type::context() const ASIO_NOEXCEPT

戻り値

thread_pool&

on_work_started()

Inform the thread pool that it has some outstanding work to do.

This function is used to inform the thread pool that some work has begun. This ensures that the thread pool's function will not return while the work is underway.

void asio::thread_pool::executor_type::on_work_started() const ASIO_NOEXCEPT

on_work_finished()

Inform the thread pool that some work is no longer outstanding.

This function is used to inform the thread pool that some work has finished. Once the count of unfinished work reaches zero, the thread pool's function is permitted to exit.

void asio::thread_pool::executor_type::on_work_finished() const ASIO_NOEXCEPT

dispatch()

Request the thread pool to invoke the given function object.

This function is used to ask the thread pool to execute the given function object. If the current thread belongs to the pool, executes the function before returning. Otherwise, the function will be scheduled to run on the thread pool.

void asio::thread_pool::executor_type::dispatch(ASIO_MOVE_ARG(Function) f, const Allocator &a) const

引数

  • ASIO_MOVE_ARG(Function) f The 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:
  • constAllocator & a An allocator that may be used by the executor to allocate the internal storage needed for function invocation.

post()

Request the thread pool to invoke the given function object.

This function is used to ask the thread pool to execute the given function object. The function object will never be executed inside . Instead, it will be scheduled to run on the thread pool.

void asio::thread_pool::executor_type::post(ASIO_MOVE_ARG(Function) f, const Allocator &a) const

引数

  • ASIO_MOVE_ARG(Function) f The 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:
  • constAllocator & a An allocator that may be used by the executor to allocate the internal storage needed for function invocation.

defer()

Request the thread pool to invoke the given function object.

If the current thread belongs to the thread pool, will delay scheduling the function object until the current thread returns control to the pool.

void asio::thread_pool::executor_type::defer(ASIO_MOVE_ARG(Function) f, const Allocator &a) const

引数

  • ASIO_MOVE_ARG(Function) f The 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:
  • constAllocator & a An allocator that may be used by the executor to allocate the internal storage needed for function invocation.

running_in_this_thread()

Determine whether the thread pool is running in the current thread.

bool asio::thread_pool::executor_type::running_in_this_thread() const ASIO_NOEXCEPT

戻り値

bool if the current thread belongs to the pool. Otherwise returns .