ddc
Public Member Functions | Public Attributes | List of all members
CDDCServerThreadPool Class Reference

high-level class used by CDDCServer for a per-client thread pool More...

#include <ServerThread.h>

Collaboration diagram for CDDCServerThreadPool:
Collaboration graph
[legend]

Public Member Functions

 CDDCServerThreadPool (void)
 
 CDDCServerThreadPool (CDDCServer *Server, size_t nWorkers=4, size_t maxQueueSize=256)
 
virtual ~CDDCServerThreadPool ()
 
virtual void start (CDDCServer *Server, size_t nWorkers=4, size_t maxQueueSize=256)
 
virtual void stop (void)
 
size_t size (void) const
 
bool started (void) const
 

Public Attributes

ddcThreadQueue< int > m_Queue
 
vector< CDDCServerThread * > m_Workers
 
pthread_mutex_t m_mutex
 

Detailed Description

high-level class used by CDDCServer for a per-client thread pool

Constructor & Destructor Documentation

◆ CDDCServerThreadPool() [1/2]

CDDCServerThreadPool::CDDCServerThreadPool ( void  )

default constructor

◆ CDDCServerThreadPool() [2/2]

CDDCServerThreadPool::CDDCServerThreadPool ( CDDCServer Server,
size_t  nWorkers = 4,
size_t  maxQueueSize = 256 
)

wrapper for constructor and start()

References ddcThread::start().

Here is the call graph for this function:

◆ ~CDDCServerThreadPool()

CDDCServerThreadPool::~CDDCServerThreadPool ( )
virtual

default destructor

Member Function Documentation

◆ start()

void CDDCServerThreadPool::start ( CDDCServer Server,
size_t  nWorkers = 4,
size_t  maxQueueSize = 256 
)
virtual

create and start worker nWorkers worker-threads

  • throws an exception if already started

References CDDCServerThread::CDDCServerThread(), ddcLogInfo, Format(), and nWorkers.

Referenced by CDDCServer::StartClientThreads().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop()

void CDDCServerThreadPool::stop ( void  )
virtual

terminate any worker threads and free up memory

Referenced by CDDCServer::Shutdown().

Here is the caller graph for this function:

◆ size()

size_t CDDCServerThreadPool::size ( void  ) const
inline

current number of worker thrads

◆ started()

bool CDDCServerThreadPool::started ( void  ) const
inline

wrapper for size()!=0

Member Data Documentation

◆ m_Queue

ddcThreadQueue< int > CDDCServerThreadPool::m_Queue

item queue for thread-pool mode

Referenced by CDDCServer::HandleClientConnection(), and CDDCServerThread::run().

◆ m_Workers

vector<CDDCServerThread*> CDDCServerThreadPool::m_Workers

worker threads for thread-pool mode

◆ m_mutex

pthread_mutex_t CDDCServerThreadPool::m_mutex

pthread mutex for locking parent access

Referenced by CDDCServerThread::run().


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