CPPMyth
Library to interoperate with MythTV server
Loading...
Searching...
No Matches
NSROOT::OS::ThreadPool Class Reference
Collaboration diagram for NSROOT::OS::ThreadPool:

Public Member Functions

 ThreadPool (unsigned size)
bool enqueue (Worker *worker)
unsigned max_size () const
void set_max_size (unsigned size)
void set_keep_alive (unsigned millisec)
unsigned size () const
unsigned queue_size () const
bool is_queue_empty () const
bool wait_empty ()
bool wait_empty_for (unsigned millisec)
void suspend ()
void resume ()
bool is_suspended () const
void reset ()
void stop ()
void start ()
bool is_stopped () const

Private Member Functions

Workerpop_queue (WorkerThread *_thread)
void wait_queue (WorkerThread *_thread)
void start_thread (WorkerThread *_thread)
void finalize_thread (WorkerThread *_thread)
void __resize ()

Private Attributes

unsigned m_size
unsigned m_keepAlive
unsigned m_poolSize
unsigned m_waitingCount
volatile bool m_stopped
volatile bool m_suspended
volatile bool m_empty
std::queue< Worker * > m_queue
std::set< WorkerThread * > m_pool
Mutex m_mutex
Condition< volatile bool > m_condition
Event m_queueFill
Event m_queueEmpty

Friends

class WorkerThread

Detailed Description

Definition at line 39 of file threadpool.h.

Constructor & Destructor Documentation

◆ ThreadPool() [1/2]

ThreadPool::ThreadPool ( )

Definition at line 34 of file threadpool.cpp.

◆ ThreadPool() [2/2]

ThreadPool::ThreadPool ( unsigned size)

Definition at line 45 of file threadpool.cpp.

◆ ~ThreadPool()

ThreadPool::~ThreadPool ( )

Definition at line 56 of file threadpool.cpp.

Member Function Documentation

◆ __resize()

void ThreadPool::__resize ( )
private

Definition at line 253 of file threadpool.cpp.

◆ enqueue()

bool ThreadPool::enqueue ( Worker * worker)

Definition at line 81 of file threadpool.cpp.

◆ finalize_thread()

void ThreadPool::finalize_thread ( WorkerThread * _thread)
private

Definition at line 238 of file threadpool.cpp.

◆ is_queue_empty()

bool ThreadPool::is_queue_empty ( ) const

Definition at line 135 of file threadpool.cpp.

◆ is_stopped()

bool ThreadPool::is_stopped ( ) const

Definition at line 194 of file threadpool.cpp.

◆ is_suspended()

bool ThreadPool::is_suspended ( ) const

Definition at line 164 of file threadpool.cpp.

◆ max_size()

unsigned NSROOT::OS::ThreadPool::max_size ( ) const
inline

Definition at line 49 of file threadpool.h.

◆ pop_queue()

Worker * ThreadPool::pop_queue ( WorkerThread * _thread)
private

Definition at line 200 of file threadpool.cpp.

◆ queue_size()

unsigned ThreadPool::queue_size ( ) const

Definition at line 129 of file threadpool.cpp.

◆ reset()

void ThreadPool::reset ( )

Definition at line 170 of file threadpool.cpp.

◆ resume()

void ThreadPool::resume ( )

Definition at line 157 of file threadpool.cpp.

◆ set_keep_alive()

void ThreadPool::set_keep_alive ( unsigned millisec)

Definition at line 117 of file threadpool.cpp.

◆ set_max_size()

void ThreadPool::set_max_size ( unsigned size)

Definition at line 109 of file threadpool.cpp.

◆ size()

unsigned ThreadPool::size ( ) const

Definition at line 123 of file threadpool.cpp.

◆ start()

void ThreadPool::start ( )

Definition at line 188 of file threadpool.cpp.

◆ start_thread()

void ThreadPool::start_thread ( WorkerThread * _thread)
private

Definition at line 230 of file threadpool.cpp.

◆ stop()

void ThreadPool::stop ( )

Definition at line 182 of file threadpool.cpp.

◆ suspend()

void ThreadPool::suspend ( )

Definition at line 151 of file threadpool.cpp.

◆ wait_empty()

bool ThreadPool::wait_empty ( )

Definition at line 141 of file threadpool.cpp.

◆ wait_empty_for()

bool ThreadPool::wait_empty_for ( unsigned millisec)

Definition at line 146 of file threadpool.cpp.

◆ wait_queue()

void ThreadPool::wait_queue ( WorkerThread * _thread)
private

Definition at line 217 of file threadpool.cpp.

◆ WorkerThread

friend class WorkerThread
friend

Definition at line 41 of file threadpool.h.

Field Documentation

◆ m_condition

Condition<volatile bool> NSROOT::OS::ThreadPool::m_condition
private

Definition at line 83 of file threadpool.h.

◆ m_empty

volatile bool NSROOT::OS::ThreadPool::m_empty
private

Definition at line 78 of file threadpool.h.

◆ m_keepAlive

unsigned NSROOT::OS::ThreadPool::m_keepAlive
private

Definition at line 73 of file threadpool.h.

◆ m_mutex

Mutex NSROOT::OS::ThreadPool::m_mutex
mutableprivate

Definition at line 82 of file threadpool.h.

◆ m_pool

std::set<WorkerThread*> NSROOT::OS::ThreadPool::m_pool
private

Definition at line 81 of file threadpool.h.

◆ m_poolSize

unsigned NSROOT::OS::ThreadPool::m_poolSize
private

Definition at line 74 of file threadpool.h.

◆ m_queue

std::queue<Worker*> NSROOT::OS::ThreadPool::m_queue
private

Definition at line 80 of file threadpool.h.

◆ m_queueEmpty

Event NSROOT::OS::ThreadPool::m_queueEmpty
private

Definition at line 85 of file threadpool.h.

◆ m_queueFill

Event NSROOT::OS::ThreadPool::m_queueFill
private

Definition at line 84 of file threadpool.h.

◆ m_size

unsigned NSROOT::OS::ThreadPool::m_size
private

Definition at line 72 of file threadpool.h.

◆ m_stopped

volatile bool NSROOT::OS::ThreadPool::m_stopped
private

Definition at line 76 of file threadpool.h.

◆ m_suspended

volatile bool NSROOT::OS::ThreadPool::m_suspended
private

Definition at line 77 of file threadpool.h.

◆ m_waitingCount

unsigned NSROOT::OS::ThreadPool::m_waitingCount
private

Definition at line 75 of file threadpool.h.


The documentation for this class was generated from the following files:
  • /home/jlb/src/janbar/PVR/cppmythlib/cppmyth/src/private/os/threads/threadpool.h
  • /home/jlb/src/janbar/PVR/cppmythlib/cppmyth/src/private/os/threads/threadpool.cpp