The Gaudi Framework  v29r0 (ff2e7097)
boost::threadpool Namespace Reference

Namespaces

 detail
 

Classes

struct  empty_controller
 SizePolicyController which provides no functionality. More...
 
class  fifo_scheduler
 SchedulingPolicy which implements FIFO ordering. More...
 
class  future
 Experimental. More...
 
class  immediately
 ShutdownPolicy which does not wait for any tasks or worker termination. More...
 
class  lifo_scheduler
 SchedulingPolicy which implements LIFO ordering. More...
 
class  looped_task_func
 Looped task function object. More...
 
class  prio_scheduler
 SchedulingPolicy which implements prioritized ordering. More...
 
class  prio_task_func
 Prioritized task function object. More...
 
class  resize_controller
 SizePolicyController which allows resizing. More...
 
class  static_size
 SizePolicy which preserves the thread count. More...
 
class  thread_pool
 Thread pool. More...
 
class  wait_for_active_tasks
 ShutdownPolicy which waits for the completion of all active tasks and the worker termination afterwards. More...
 
class  wait_for_all_tasks
 ShutdownPolicy which waits for the completion of all tasks and the worker termination afterwards. More...
 

Typedefs

typedef thread_pool< task_func, fifo_scheduler, static_size, resize_controller, wait_for_all_tasksfifo_pool
 Fifo pool. More...
 
typedef thread_pool< task_func, lifo_scheduler, static_size, resize_controller, wait_for_all_taskslifo_pool
 Lifo pool. More...
 
typedef thread_pool< prio_task_func, prio_scheduler, static_size, resize_controller, wait_for_all_tasksprio_pool
 Pool for prioritized task. More...
 
typedef fifo_pool pool
 A standard pool. More...
 
typedef function0< void > task_func
 Standard task function object. More...
 

Functions

template<class Pool , class Function >
disable_if< is_void< typename result_of< Function() >::type >, future< typename result_of< Function() >::type >>::type schedule (Pool &pool, const Function &task)
 
template<typename Pool , typename Runnable >
bool schedule (Pool &pool, shared_ptr< Runnable > const &obj)
 Schedules a Runnable for asynchronous execution. More...
 
template<typename Pool >
enable_if< is_void< typename result_of< typename Pool::task_type() >::type >, bool >::type schedule (Pool &pool, typename Pool::task_type const &task)
 Schedules a task for asynchronous execution. More...
 
template<typename Pool >
enable_if< is_void< typename result_of< typename Pool::task_type() >::type >, bool >::type schedule (shared_ptr< Pool > const pool, typename Pool::task_type const &task)
 

Typedef Documentation

Fifo pool.

The pool's tasks are fifo scheduled task_func functors.

Definition at line 202 of file pool.hpp.

Lifo pool.

The pool's tasks are lifo scheduled task_func functors.

Definition at line 210 of file pool.hpp.

A standard pool.

The pool's tasks are fifo scheduled task_func functors.

Definition at line 226 of file pool.hpp.

Pool for prioritized task.

The pool's tasks are prioritized prio_task_func functors.

Definition at line 218 of file pool.hpp.

typedef function0<void> boost::threadpool::task_func

Standard task function object.

This function object wraps a nullary function which returns void. The wrapped function is invoked by calling the operator ().

See also
boost function library

Definition at line 37 of file task_adaptors.hpp.

Function Documentation

template<typename Pool , typename Runnable >
bool boost::threadpool::schedule ( Pool &  pool,
shared_ptr< Runnable > const &  obj 
)

Schedules a Runnable for asynchronous execution.

A Runnable is an arbitrary class with a run() member function. This a convenience shorthand for pool->schedule(bind(&Runnable::run, task_object)).

Parameters

Definition at line 36 of file pool_adaptors.hpp.

37  {
38  return pool->schedule(bind(&Runnable::run, obj));
39  }
T bind(T...args)
template<typename Pool >
enable_if< is_void< typename result_of< typename Pool::task_type() >::type >, bool >::type boost::threadpool::schedule ( Pool &  pool,
typename Pool::task_type const &  task 
)

Schedules a task for asynchronous execution.

The task will be executed once only.

Parameters
taskThe task function object.

Definition at line 49 of file pool_adaptors.hpp.

50  {
51  return pool.schedule(task);
52  }
template<typename Pool >
enable_if< is_void< typename result_of< typename Pool::task_type() >::type >, bool >::type boost::threadpool::schedule ( shared_ptr< Pool > const  pool,
typename Pool::task_type const &  task 
)

Definition at line 60 of file pool_adaptors.hpp.

61  {
62  return pool->schedule(task);
63  }
template<class Pool , class Function >
disable_if< is_void< typename result_of< Function() >::type >, future< typename result_of< Function() >::type >>::type boost::threadpool::schedule ( Pool &  pool,
const Function &  task 
)

Definition at line 111 of file future.hpp.

112 {
113  typedef typename result_of< Function() >::type future_result_type;
114 
115  // create future impl and future
116  shared_ptr<detail::future_impl<future_result_type> > impl(new detail::future_impl<future_result_type>);
117  future <future_result_type> res(impl);
118 
119  // schedule future impl
120  pool.schedule(detail::future_impl_task_func<detail::future_impl, Function>(task, impl));
121 
122  // return future
123  return res;
124 
125 /*
126  TODO
127  if(pool->schedule(bind(&Future::run, future)))
128  {
129  return future;
130  }
131  else
132  {
133  // construct empty future
134  return error_future;
135  }
136  */
137 }