35 #ifndef _BLAZE_UTIL_THREAD_H_
36 #define _BLAZE_UTIL_THREAD_H_
43 #include <boost/bind.hpp>
44 #include <boost/scoped_ptr.hpp>
57 template<
typename TT,
typename MT,
typename LT,
typename CT >
class ThreadPool;
246 template<
typename TT
270 template<
typename Callable >
271 explicit inline Thread( Callable func );
273 template<
typename Callable,
typename A1 >
274 explicit inline Thread( Callable func, A1 a1 );
276 template<
typename Callable,
typename A1,
typename A2 >
277 explicit inline Thread( Callable func, A1 a1, A2 a2 );
279 template<
typename Callable,
typename A1,
typename A2,
typename A3 >
280 explicit inline Thread( Callable func, A1 a1, A2 a2, A3 a3 );
282 template<
typename Callable,
typename A1,
typename A2,
typename A3,
typename A4 >
283 explicit inline Thread( Callable func, A1 a1, A2 a2, A3 a3, A4 a4 );
285 template<
typename Callable,
typename A1,
typename A2,
typename A3,
typename A4,
typename A5 >
286 explicit inline Thread( Callable func, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 );
357 template<
typename TT
362 : terminated_( false )
379 template<
typename TT
383 template<
typename Callable >
403 template<
typename TT
407 template<
typename Callable
429 template<
typename TT
433 template<
typename Callable
457 template<
typename TT
461 template<
typename Callable
487 template<
typename TT
491 template<
typename Callable
519 template<
typename TT
523 template<
typename Callable
549 template<
typename TT
575 template<
typename TT
581 return thread_->joinable();
594 template<
typename TT
613 template<
typename TT
637 template<
typename TT
647 while( pool_->executeTask() ) {}
bool hasTerminated() const
Returns whether the thread has terminated its execution.
Definition: Thread.h:617
Thread(ThreadPoolType *pool)
Starting a thread in a thread pool.
Definition: Thread.h:361
Base class for non-copyable class instances.
volatile bool terminated_
Thread termination flag.
Definition: Thread.h:323
bool joinable() const
Returns whether this is a thread of execution.
Definition: Thread.h:579
ThreadHandle thread_
Handle to the thread of execution.
Definition: Thread.h:328
void join()
Waiting for a thread of execution to complete.
Definition: Thread.h:598
Base class for non-copyable class instances.The NonCopyable class is intended to work as a base class...
Definition: NonCopyable.h:63
void run()
Execution function for threads in a thread pool.
Definition: Thread.h:641
Implementation of a single thread of execution.
Definition: Thread.h:250
Header file for run time assertion macros.
boost::scoped_ptr< ThreadType > ThreadHandle
Handle for a single thread.
Definition: Thread.h:256
ThreadPoolType * pool_
Handle to the managing thread pool.
Definition: Thread.h:327
ThreadPool< TT, MT, LT, CT > ThreadPoolType
Type of the managing thread pool.
Definition: Thread.h:255
TT ThreadType
Type of the encapsulated thread.
Definition: Thread.h:254
Implementation of a thread pool.
Definition: Thread.h:57
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
~Thread()
Destructor for the Thread class.
Definition: Thread.h:553