Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::executors::thread_executor Class Reference

#include <thread_executor.hpp>

Public Types

typedef executors::work work
 type-erasure to store the works to do More...
 

Public Member Functions

bool try_executing_one ()
 Effects: try to execute one task. More...
 
 thread_executor ()
 thread_executor is not copyable. More...
 
 ~thread_executor ()
 Effects: Destroys the inline executor. More...
 
void close ()
 Effects: close the thread_executor for submissions. More...
 
bool closed ()
 Returns: whether the pool is closed for submissions. More...
 
void submit (void(*closure)())
 Requires: Closure is a model of Callable(void()) and a model of CopyConstructible/MoveConstructible. More...
 
template<typename Closure >
void submit (BOOST_THREAD_FWD_REF(Closure) closure)
 
template<typename Pred >
bool reschedule_until (Pred const &)
 Requires: This must be called from an scheduled task. More...
 

Public Attributes

bool closed_
 

Member Typedef Documentation

type-erasure to store the works to do

Constructor & Destructor Documentation

boost::executors::thread_executor::thread_executor ( )
inline

thread_executor is not copyable.

Effects: creates a inline executor that runs closures immediately.

Throws: Nothing.

boost::executors::thread_executor::~thread_executor ( )
inline

Effects: Destroys the inline executor.

Synchronization: The completion of all the closures happen before the completion of the thread_executor destructor.

References close().

Member Function Documentation

void boost::executors::thread_executor::close ( )
inline

Effects: close the thread_executor for submissions.

The loop will work until there is no more closures to run.

Referenced by ~thread_executor().

bool boost::executors::thread_executor::closed ( )
inline

Returns: whether the pool is closed for submissions.

References closed_.

Referenced by submit().

template<typename Pred >
bool boost::executors::thread_executor::reschedule_until ( Pred const &  )
inline

Requires: This must be called from an scheduled task.

Effects: reschedule functions until pred()

void boost::executors::thread_executor::submit ( void(*)()  closure)
inline

Requires: Closure is a model of Callable(void()) and a model of CopyConstructible/MoveConstructible.

Effects: The specified closure will be scheduled for execution at some point in the future. If invoked closure throws an exception the thread_executor will call std::terminate, as is the case with threads.

Synchronization: completion of closure on a particular thread happens before destruction of thread's thread local variables.

Throws: sync_queue_is_closed if the thread pool is closed. Whatever exception that can be throw while storing the closure.

References closed().

template<typename Closure >
void boost::executors::thread_executor::submit ( BOOST_THREAD_FWD_REF(Closure)  closure)
inline

References closed().

bool boost::executors::thread_executor::try_executing_one ( )
inline

Effects: try to execute one task.

Returns: whether a task has been executed. Throws: whatever the current task constructor throws or the task() throws.

Member Data Documentation

bool boost::executors::thread_executor::closed_

Referenced by closed().


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