Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

thread_source

Abstract base class for a source of thread workers.

Description

Note that in Boost 1.54, and possibly later versions, asio::io_service on Windows appears to dislike being destructed during static data deinit, hence why this inherits from std::enable_shared_from_this<> in order that it may be reference count deleted before static data deinit occurs.

Synopsis
class thread_source
      : public std::enable_shared_from_this< thread_source >
{
  // ...
};
Member Function(s)

Function

Description

Parameters

Returns

asio::io_service & io_service()

Returns the underlying io_service.

template<class R>
void enqueue(enqueued_task< R > task)

Sends a task to the thread pool for execution.

enqueued_task< R >: task:

template<class F>
shared_future< typename std::result_of< F()>::type > enqueue(F f)

Sends some callable entity to the thread pool for execution.

F: f: Any instance of a callable type

An enqueued task for the enqueued callable

Header

#include <boost/afio/v2/afio.hpp>


PrevUpHomeNext