Mixes for Privacy and Anonymity in the Internet
Public Member Functions | Private Attributes | Friends
CAThreadPool Class Reference

This class bla bla. More...

List of all members.

Public Member Functions

 CAThreadPool (UINT32 num_worker_threads, UINT32 max_queue_size, bool b_do_not_block_when_full)
 ~CAThreadPool ()
SINT32 destroy (bool bWaitForFinish)
SINT32 addRequest (THREAD_MAIN_TYP, void *args)
 Adds a new request (task) to this threadpool.
UINT32 countRequests ()

Private Attributes

UINT32 m_NumThreads
UINT32 m_MaxQueueSize
bool m_bDoNotBlockWhenFull
CAThread ** m_parThreads
volatile UINT32 m_CurQueueSize
tpool_work_tm_pQueueHead
tpool_work_tm_pQueueTail
volatile bool m_bQueueClosed
volatile bool m_bShutdown
CAMutexm_pmutexQueue
CAConditionVariablem_pcondNotEmpty
CAConditionVariablem_pcondNotFull
CAConditionVariablem_pcondEmpty

Friends

THREAD_RETURN worker_thread_main_loop (void *args)

Detailed Description

This class bla bla.


Constructor & Destructor Documentation

CAThreadPool::CAThreadPool ( UINT32  num_worker_threads,
UINT32  max_queue_size,
bool  b_do_not_block_when_full 
)

References destroy().


Member Function Documentation

SINT32 CAThreadPool::addRequest ( THREAD_MAIN_TYP  routine,
void *  args 
)

Adds a new request (task) to this threadpool.

Return values:
E_SPACeif there was no more space in the waiting queue and we do not want to wait for an other request to finish
E_SUCCESSif this request was added to the working queue

References tpool_work::arg, CAConditionVariable::broadcast(), E_SPACE, E_SUCCESS, E_UNKNOWN, CAMutex::lock(), m_bDoNotBlockWhenFull, m_bQueueClosed, m_bShutdown, m_CurQueueSize, m_MaxQueueSize, m_pcondNotEmpty, m_pcondNotFull, m_pmutexQueue, m_pQueueHead, m_pQueueTail, tpool_work::next, CAMsg::printMsg(), tpool_work::routine, CAMutex::unlock(), and CAConditionVariable::wait().

Referenced by fm_loopAcceptUsers().

References m_CurQueueSize.

Referenced by fm_loopAcceptUsers().

SINT32 CAThreadPool::destroy ( bool  bWaitForFinish)

Friends And Related Function Documentation

THREAD_RETURN worker_thread_main_loop ( void *  args) [friend]

Referenced by CAThreadPool().


Member Data Documentation

volatile bool CAThreadPool::m_bQueueClosed [private]

Referenced by addRequest(), CAThreadPool(), and destroy().

volatile bool CAThreadPool::m_bShutdown [private]

Referenced by CAThreadPool(), and destroy().

Referenced by CAThreadPool(), and destroy().