| The Gaudi Framework v30r0 (c919700c)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
boost::threadpool::detail::worker_thread< Pool > Class Template Reference

Thread pool worker. More...

`#include <src/threadpool/boost/threadpool/detail/worker_thread.hpp>`

Inheritance diagram for boost::threadpool::detail::worker_thread< Pool >:
[legend]
Collaboration diagram for boost::threadpool::detail::worker_thread< Pool >:
[legend]

## Public Types
typedef Pool | pool_type
| Indicates the pool's type. More...

## Public Member Functions
void | run ()
| Executes pool's tasks sequentially. More...
void | join ()
| Joins the worker's thread. More...

## Static Public Member Functions
static void | create_and_attach (shared_ptr< pool_type > const &pool)
| Constructs a new worker thread and attaches it to the pool. More...

## Private Member Functions
| worker_thread (shared_ptr< pool_type > const &pool)
| Constructs a new worker. More...
void | died_unexpectedly ()
| Notifies that an exception occurred in the run loop. More...

## Private Attributes
shared_ptr< pool_type > | m_pool
| Pointer to the pool which created the worker. More...
shared_ptr< boost::thread > | m_thread
| Pointer to the thread which executes the run loop. More...

## Detailed Description

### template<typename Pool>
class boost::threadpool::detail::worker_thread< Pool >

Thread pool worker.

A worker_thread represents a thread of execution. The worker is attached to a thread pool and processes tasks of that pool. The lifetime of the worker and its internal boost::thread is managed automatically.

This class is a helper class and cannot be constructed or accessed directly.

See also
  pool_core

Definition at line 44 of file worker_thread.hpp.

## Member Typedef Documentation

template<typename Pool>

typedef Pool boost::threadpool::detail::worker_thread< Pool >::pool_type

Indicates the pool's type.

Definition at line 49 of file worker_thread.hpp.

## Constructor & Destructor Documentation

template<typename Pool>

boost::threadpool::detail::worker_thread< Pool >::worker_thread | ( | shared_ptr< pool_type > const & | pool | ) |
| inline private

Constructs a new worker.

Parameters

  pool | Pointer to it's parent pool.

See also
  function create_and_attach

Definition at line 60 of file worker_thread.hpp.

61 : m_pool(pool)
62 {
63 assert(pool);
64 }
pool
Definition: PoolClasses.h:11
boost::threadpool::detail::worker_thread::m_pool
shared_ptr< pool_type > m_pool
Pointer to the pool which created the worker.
Definition: worker_thread.hpp:52

## Member Function Documentation

template<typename Pool>

static void boost::threadpool::detail::worker_thread< Pool >::create_and_attach | ( | shared_ptr< pool_type > const & | pool | ) |
| inline static

Constructs a new worker thread and attaches it to the pool.

Parameters

  pool | Pointer to the pool.

Definition at line 100 of file worker_thread.hpp.

101 {
102 shared_ptr<worker_thread> worker(new worker_thread(pool));
103 if(worker)
104 {
105 worker->m_thread.reset(new boost::thread(bind(&worker_thread::run, worker)));
106 }
107 }
boost::threadpool::detail::worker_thread::worker_thread
worker_thread(shared_ptr< pool_type > const &pool)
Constructs a new worker.
Definition: worker_thread.hpp:60
pool
Definition: PoolClasses.h:11
boost::threadpool::detail::worker_thread::run
void run()
Executes pool&#39;s tasks sequentially.
Definition: worker_thread.hpp:78
std::bind
T bind(T...args)
template<typename Pool>

void boost::threadpool::detail::worker_thread< Pool >::died_unexpectedly | ( |  | ) |
| inline private

Notifies that an exception occurred in the run loop.

Definition at line 69 of file worker_thread.hpp.

70 {
71 m_pool->worker_died_unexpectedly(this->shared_from_this());
72 }
boost::threadpool::detail::worker_thread::m_pool
shared_ptr< pool_type > m_pool
Pointer to the pool which created the worker.
Definition: worker_thread.hpp:52
template<typename Pool>

void boost::threadpool::detail::worker_thread< Pool >::join | ( |  | ) |
| inline

Joins the worker's thread.

Definition at line 91 of file worker_thread.hpp.

92 {
93 m_thread->join();
94 }
boost::threadpool::detail::worker_thread::m_thread
shared_ptr< boost::thread > m_thread
Pointer to the thread which executes the run loop.
Definition: worker_thread.hpp:53
template<typename Pool>

void boost::threadpool::detail::worker_thread< Pool >::run | ( |  | ) |
| inline

Executes pool's tasks sequentially.

Definition at line 78 of file worker_thread.hpp.

79 {
80 scope_guard notify_exception(bind(&worker_thread::died_unexpectedly, this));
81
82 while(m_pool->execute_task()) {}
83
84 notify_exception.disable();
85 m_pool->worker_destructed(this->shared_from_this());
86 }
boost::threadpool::detail::worker_thread::died_unexpectedly
void died_unexpectedly()
Notifies that an exception occurred in the run loop.
Definition: worker_thread.hpp:69
std::bind
T bind(T...args)
boost::threadpool::detail::worker_thread::m_pool
shared_ptr< pool_type > m_pool
Pointer to the pool which created the worker.
Definition: worker_thread.hpp:52

## Member Data Documentation

template<typename Pool>

shared_ptr<pool_type> boost::threadpool::detail::worker_thread< Pool >::m_pool
| private

Pointer to the pool which created the worker.

Definition at line 52 of file worker_thread.hpp.

template<typename Pool>

shared_ptr<boost::thread> boost::threadpool::detail::worker_thread< Pool >::m_thread
| private

Pointer to the thread which executes the run loop.

Definition at line 53 of file worker_thread.hpp.

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

- GaudiMTTools/src/threadpool/boost/threadpool/detail/worker_thread.hpp