22 #ifndef THREADPOOL_POOL_HPP_INCLUDED 23 #define THREADPOOL_POOL_HPP_INCLUDED 25 #include <boost/ref.hpp> 40 namespace boost {
namespace threadpool
68 template <
typename>
class SchedulingPolicy = fifo_scheduler,
69 template <
typename>
class SizePolicy = static_size,
70 template <
typename>
class SizePolicyController = resize_controller,
71 template <
typename>
class ShutdownPolicy = wait_for_all_tasks
100 : m_core(new pool_core_type)
101 , m_shutdown_controller(static_cast<void*>(0), bind(&pool_core_type::shutdown, m_core))
103 size_policy_type::init(*m_core, initial_threads);
113 return m_core->size_controller();
122 return m_core->size();
132 return m_core->schedule(task);
141 return m_core->active();
150 return m_core->pending();
168 return m_core->empty();
176 void wait(
size_t task_threshold = 0)
const 178 m_core->wait(task_threshold);
189 bool wait(xtime
const & timestamp,
size_t task_threshold = 0)
const 191 return m_core->wait(timestamp, task_threshold);
232 #endif // THREADPOOL_POOL_HPP_INCLUDED void wait(size_t task_threshold=0) const
Task task_type
Indicates the task's type.
The namespace threadpool contains a thread pool and related utility classes.
detail::pool_core< Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy > pool_core_type
SchedulingPolicy< task_type > scheduler_type
Indicates the scheduler's type.
SizePolicyController< pool_core_type > size_controller_type
SizePolicy< pool_core_type > size_policy_type
thread_pool< task_func, fifo_scheduler, static_size, resize_controller, wait_for_all_tasks > fifo_pool
Fifo pool.
bool schedule(task_type const &task)
thread_pool< task_func, lifo_scheduler, static_size, resize_controller, wait_for_all_tasks > lifo_pool
Lifo pool.
thread_pool(size_t initial_threads=0)
thread_pool< prio_task_func, prio_scheduler, static_size, resize_controller, wait_for_all_tasks > prio_pool
Pool for prioritized task.
shared_ptr< void > m_shutdown_controller
fifo_pool pool
A standard pool.
size_controller_type size_controller()
shared_ptr< pool_core_type > m_core
bool wait(xtime const ×tamp, size_t task_threshold=0) const
The locking_ptr is smart pointer with a scoped locking mechanism.
function0< void > task_func
Standard task function object.
Task scheduling policies.