TDME2 1.9.121
Public Member Functions | Private Attributes | Friends | List of all members
ServerWorkerThreadPool Class Reference

Simple server worker thread pool class. More...

#include <tdme/network/udpserver/ServerWorkerThreadPool.h>

Inheritance diagram for ServerWorkerThreadPool:
Inheritance graph
Collaboration diagram for ServerWorkerThreadPool:
Collaboration graph

Public Member Functions

 ServerWorkerThreadPool (Barrier *startUpBarrier, const unsigned int workerCount, const unsigned int maxElements)
 Public constructor. More...
 
virtual ~ServerWorkerThreadPool ()
 Public destructor. More...
 
void start ()
 Start worker thread pool. More...
 
void stop ()
 Stop worker thread pool. More...
 
- Public Member Functions inherited from Queue< ServerRequest >
 Queue (const unsigned int maxElements)
 Public constructor. More...
 
virtual ~Queue ()
 Destructor, removes remaining elements from queue. More...
 
void stop ()
 Requests this queue to be stopped, any gets will be woke up and return NULL. More...
 
ServerRequest * getElement ()
 Gets an element from this queue, if no element exists yet the calling thread will be blocked until an element is available. More...
 
bool addElement (ServerRequest *element, const bool declinable)
 Adds an element to this queue, signals threads which waits for an element. More...
 

Private Attributes

BarrierstartUpBarrier
 
unsigned int workerCount
 
ServerWorkerThread ** worker
 

Friends

class ServerWorkerThread
 

Additional Inherited Members

- Protected Types inherited from Queue< ServerRequest >
typedef queue< ServerRequest * > QueueType
 
- Protected Attributes inherited from Queue< ServerRequest >
QueueType data
 
unsigned int maxElements
 

Detailed Description

Simple server worker thread pool class.

Author
Andreas Drewke

Definition at line 23 of file ServerWorkerThreadPool.h.

Constructor & Destructor Documentation

◆ ServerWorkerThreadPool()

ServerWorkerThreadPool ( Barrier startUpBarrier,
const unsigned int  workerCount,
const unsigned int  maxElements 
)

Public constructor.

Parameters
startUpBarrierstart up barrier
workerCountworker count
maxElementsmax elements

Definition at line 10 of file ServerWorkerThreadPool.cpp.

◆ ~ServerWorkerThreadPool()

~ServerWorkerThreadPool ( )
virtual

Public destructor.

Definition at line 19 of file ServerWorkerThreadPool.cpp.

Member Function Documentation

◆ start()

void start ( )

Start worker thread pool.

Definition at line 22 of file ServerWorkerThreadPool.cpp.

◆ stop()

void stop ( )

Stop worker thread pool.

Definition at line 30 of file ServerWorkerThreadPool.cpp.

Friends And Related Function Documentation

◆ ServerWorkerThread

friend class ServerWorkerThread
friend

Definition at line 24 of file ServerWorkerThreadPool.h.

Member Data Documentation

◆ startUpBarrier

Barrier* startUpBarrier
private

Definition at line 51 of file ServerWorkerThreadPool.h.

◆ worker

ServerWorkerThread** worker
private

Definition at line 53 of file ServerWorkerThreadPool.h.

◆ workerCount

unsigned int workerCount
private

Definition at line 52 of file ServerWorkerThreadPool.h.


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