Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
QueueTheadsPool< T > Class Template Reference

Pool of consumer threads form a queue. More...

#include <q-consumer-threads.H>

Collaboration diagram for QueueTheadsPool< T >:
[legend]

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< Tq
 

Detailed Description

template<typename T>
class QueueTheadsPool< T >

Pool of consumer threads form a queue.

Definition at line 85 of file q-consumer-threads.H.

Member Typedef Documentation

◆ Event

Definition at line 114 of file q-consumer-threads.H.

Constructor & Destructor Documentation

◆ ~QueueTheadsPool()

Member Function Documentation

◆ create_thread()

◆ handler()

template<typename T >
static void QueueTheadsPool< T >::handler ( QueueTheadsPool< T > *  threads_pool,
ConsumerQueueEvent event 
)
inlinestaticprivate

Definition at line 141 of file q-consumer-threads.H.

References Aleph::maps().

Referenced by QueueTheadsPool< T >::create_thread().

◆ is_shutdown()

template<typename T >
bool QueueTheadsPool< T >::is_shutdown ( )
inline

◆ is_suspended()

template<typename T >
bool QueueTheadsPool< T >::is_suspended ( )
inline

◆ put()

◆ resume()

◆ run_event()

◆ shutdown()

◆ suspend()

Member Data Documentation

◆ cond

◆ event_list

template<typename T >
DynList<ConsumerQueueEvent*> QueueTheadsPool< T >::event_list
private

Definition at line 120 of file q-consumer-threads.H.

Referenced by QueueTheadsPool< T >::create_thread().

◆ lck

◆ num_active

template<typename T >
size_t QueueTheadsPool< T >::num_active = 0
private

Definition at line 122 of file q-consumer-threads.H.

Referenced by QueueTheadsPool< T >::run_event().

◆ num_threads

◆ q

template<typename T >
DynListQueue<T> QueueTheadsPool< T >::q
private

◆ shutdown_cv

template<typename T >
std::condition_variable QueueTheadsPool< T >::shutdown_cv
private

◆ shutdown_done

◆ shutting_down

◆ suspended


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