17 #ifndef THREADPOOL_TASK_ADAPTERS_HPP_INCLUDED 18 #define THREADPOOL_TASK_ADAPTERS_HPP_INCLUDED 21 #include <boost/smart_ptr.hpp> 22 #include <boost/function.hpp> 23 #include <boost/thread.hpp> 26 namespace boost {
namespace threadpool
66 : m_priority(priority)
67 , m_function(function)
111 #if BOOST_VERSION >= 15000 112 boost::chrono::milliseconds m_break;
126 : m_function(function)
127 #if BOOST_VERSION >= 15000
131 #if BOOST_VERSION < 15000 132 m_break_s = interval / 1000;
133 m_break_ns = (interval - m_break_s * 1000) * 1000 * 1000;
143 #if BOOST_VERSION >= 15000 144 if(m_break > boost::chrono::milliseconds(0))
145 boost::this_thread::sleep_for(m_break);
147 if(m_break_s > 0 || m_break_ns > 0)
151 xtime_get(&xt, TIME_UTC);
152 xt.nsec += m_break_ns;
159 #if BOOST_VERSION >= 15000 160 if(m_break > boost::chrono::milliseconds(0))
161 boost::this_thread::sleep_for(m_break);
163 if(m_break_s > 0 || m_break_ns > 0)
166 xtime_get(&xt, TIME_UTC);
167 xt.nsec += m_break_ns;
185 #endif // THREADPOOL_TASK_ADAPTERS_HPP_INCLUDED task_func m_function
The task's function.
The namespace threadpool contains a thread pool and related utility classes.
void result_type
Indicates the functor's result type.
unsigned int m_priority
The priority of the task's function.
prio_task_func(unsigned int const priority, task_func const &function)
Constructor.
Looped task function object.
function0< bool > m_function
The task's function.
bool operator<(const prio_task_func &rhs) const
Comparison operator which realises a partial ordering based on priorities.
void operator()(void) const
Executes the task function.
void result_type
Indicates the functor's result type.
looped_task_func(function0< bool > const &function, unsigned int const interval=0)
Constructor.
unsigned int m_break_ns
Duration of breaks in nano seconds.
unsigned int m_break_s
Duration of breaks in seconds.
Prioritized task function object.
function0< void > task_func
Standard task function object.