|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Pool of consumer threads form a queue. More...
#include <q-consumer-threads.H>
Classes | |
| class | ConsumerQueueEvent |
Public Types | |
| using | Event = ConsumerQueueEvent |
Public Member Functions | |
| ~QueueTheadsPool () | |
| void | create_thread (ConsumerQueueEvent *event) |
| bool | put (T &&item) |
| void | resume () |
| void | suspend () |
| bool | is_suspended () |
| bool | is_shutdown () |
| void | shutdown () |
Private Member Functions | |
| void | run_event (ConsumerQueueEvent *event) |
Static Private Member Functions | |
| static void | handler (QueueTheadsPool< T > *threads_pool, ConsumerQueueEvent *event) |
Private Attributes | |
| std::mutex | lck |
| std::condition_variable | cond |
| DynList< ConsumerQueueEvent * > | event_list |
| size_t | num_threads = 0 |
| size_t | num_active = 0 |
| bool | suspended = true |
| bool | shutting_down = false |
| bool | shutdown_done = false |
| std::condition_variable | shutdown_cv |
| DynListQueue< T > | q |
Pool of consumer threads form a queue.
Definition at line 85 of file q-consumer-threads.H.
| using QueueTheadsPool< T >::Event = ConsumerQueueEvent |
Definition at line 114 of file q-consumer-threads.H.
|
inline |
Definition at line 132 of file q-consumer-threads.H.
References ah_domain_error_if, QueueTheadsPool< T >::lck, Aleph::maps(), and QueueTheadsPool< T >::shutdown_done.
|
inline |
Definition at line 151 of file q-consumer-threads.H.
References ah_domain_error_if, Aleph::DynList< T >::append(), QueueTheadsPool< T >::event_list, QueueTheadsPool< T >::handler(), QueueTheadsPool< T >::lck, Aleph::maps(), and QueueTheadsPool< T >::num_threads.
|
inlinestaticprivate |
Definition at line 141 of file q-consumer-threads.H.
References Aleph::maps().
Referenced by QueueTheadsPool< T >::create_thread().
|
inline |
Definition at line 211 of file q-consumer-threads.H.
References QueueTheadsPool< T >::lck, Aleph::maps(), and QueueTheadsPool< T >::shutdown_done.
|
inline |
Definition at line 205 of file q-consumer-threads.H.
References QueueTheadsPool< T >::lck, Aleph::maps(), and QueueTheadsPool< T >::suspended.
Definition at line 166 of file q-consumer-threads.H.
References ah_domain_error_if, QueueTheadsPool< T >::cond, QueueTheadsPool< T >::lck, Aleph::maps(), QueueTheadsPool< T >::num_threads, QueueTheadsPool< T >::q, and QueueTheadsPool< T >::suspended.
|
inline |
Definition at line 185 of file q-consumer-threads.H.
References QueueTheadsPool< T >::cond, QueueTheadsPool< T >::lck, Aleph::maps(), QueueTheadsPool< T >::shutting_down, and QueueTheadsPool< T >::suspended.
|
inlineprivate |
Definition at line 233 of file q-consumer-threads.H.
References QueueTheadsPool< T >::cond, ConsumerQueueEvent< T >::Executing, Aleph::HTList::is_empty(), QueueTheadsPool< T >::lck, Aleph::maps(), QueueTheadsPool< T >::num_active, QueueTheadsPool< T >::num_threads, QueueTheadsPool< T >::q, ConsumerQueueEvent< T >::Ready, QueueTheadsPool< T >::shutdown_cv, QueueTheadsPool< T >::shutting_down, and QueueTheadsPool< T >::suspended.
|
inline |
Definition at line 217 of file q-consumer-threads.H.
References QueueTheadsPool< T >::cond, QueueTheadsPool< T >::lck, Aleph::maps(), QueueTheadsPool< T >::num_threads, QueueTheadsPool< T >::shutdown_cv, QueueTheadsPool< T >::shutdown_done, and QueueTheadsPool< T >::shutting_down.
|
inline |
Definition at line 195 of file q-consumer-threads.H.
References QueueTheadsPool< T >::cond, QueueTheadsPool< T >::lck, Aleph::maps(), QueueTheadsPool< T >::shutting_down, and QueueTheadsPool< T >::suspended.
|
private |
Definition at line 119 of file q-consumer-threads.H.
Referenced by QueueTheadsPool< T >::put(), QueueTheadsPool< T >::resume(), QueueTheadsPool< T >::run_event(), QueueTheadsPool< T >::shutdown(), and QueueTheadsPool< T >::suspend().
|
private |
Definition at line 120 of file q-consumer-threads.H.
Referenced by QueueTheadsPool< T >::create_thread().
|
private |
Definition at line 118 of file q-consumer-threads.H.
Referenced by QueueTheadsPool< T >::~QueueTheadsPool(), QueueTheadsPool< T >::create_thread(), QueueTheadsPool< T >::is_shutdown(), QueueTheadsPool< T >::is_suspended(), QueueTheadsPool< T >::put(), QueueTheadsPool< T >::resume(), QueueTheadsPool< T >::run_event(), QueueTheadsPool< T >::shutdown(), and QueueTheadsPool< T >::suspend().
|
private |
Definition at line 122 of file q-consumer-threads.H.
Referenced by QueueTheadsPool< T >::run_event().
|
private |
Definition at line 121 of file q-consumer-threads.H.
Referenced by QueueTheadsPool< T >::create_thread(), QueueTheadsPool< T >::put(), QueueTheadsPool< T >::run_event(), and QueueTheadsPool< T >::shutdown().
|
private |
Definition at line 128 of file q-consumer-threads.H.
Referenced by QueueTheadsPool< T >::put(), and QueueTheadsPool< T >::run_event().
|
private |
Definition at line 126 of file q-consumer-threads.H.
Referenced by QueueTheadsPool< T >::run_event(), and QueueTheadsPool< T >::shutdown().
Definition at line 125 of file q-consumer-threads.H.
Referenced by QueueTheadsPool< T >::~QueueTheadsPool(), QueueTheadsPool< T >::is_shutdown(), and QueueTheadsPool< T >::shutdown().
Definition at line 124 of file q-consumer-threads.H.
Referenced by QueueTheadsPool< T >::resume(), QueueTheadsPool< T >::run_event(), QueueTheadsPool< T >::shutdown(), and QueueTheadsPool< T >::suspend().
Definition at line 123 of file q-consumer-threads.H.
Referenced by QueueTheadsPool< T >::is_suspended(), QueueTheadsPool< T >::put(), QueueTheadsPool< T >::resume(), QueueTheadsPool< T >::run_event(), and QueueTheadsPool< T >::suspend().