TDME2
1.9.121
src
tdme
network
udpserver
ServerWorkerThreadPool.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
tdme/tdme.h
>
4
#include <
tdme/os/threading/Barrier.h
>
5
#include <
tdme/os/threading/Queue.h
>
6
7
#include <
tdme/network/udpserver/ServerRequest.h
>
8
#include <
tdme/network/udpserver/ServerWorkerThread.h
>
9
10
using
tdme::os::threading::Barrier
;
11
using
tdme::os::threading::Queue
;
12
13
namespace
tdme
{
14
namespace
network {
15
namespace
udpserver {
16
17
class
ServerRequest;
18
19
/**
20
* @brief Simple server worker thread pool class
21
* @author Andreas Drewke
22
*/
23
class
ServerWorkerThreadPool
:
public
Queue
<ServerRequest> {
24
friend
class
ServerWorkerThread
;
25
26
public
:
27
28
/**
29
* @brief Public constructor
30
* @param startUpBarrier start up barrier
31
* @param workerCount worker count
32
* @param maxElements max elements
33
*/
34
ServerWorkerThreadPool
(
Barrier
*
startUpBarrier
,
const
unsigned
int
workerCount
,
const
unsigned
int
maxElements
);
35
36
/**
37
* @brief Public destructor
38
*/
39
virtual
~ServerWorkerThreadPool
();
40
41
/**
42
* @brief Start worker thread pool
43
*/
44
void
start
();
45
46
/**
47
* @brief Stop worker thread pool
48
*/
49
void
stop
();
50
private
:
51
Barrier
*
startUpBarrier
;
52
unsigned
int
workerCount
;
53
ServerWorkerThread
**
worker
;
54
};
55
56
};
57
};
58
};
Barrier.h
Queue.h
ServerRequest.h
ServerWorkerThread.h
tdme::network::udpserver::ServerWorkerThreadPool
Simple server worker thread pool class.
Definition:
ServerWorkerThreadPool.h:23
tdme::network::udpserver::ServerWorkerThreadPool::~ServerWorkerThreadPool
virtual ~ServerWorkerThreadPool()
Public destructor.
Definition:
ServerWorkerThreadPool.cpp:19
tdme::network::udpserver::ServerWorkerThreadPool::worker
ServerWorkerThread ** worker
Definition:
ServerWorkerThreadPool.h:53
tdme::network::udpserver::ServerWorkerThreadPool::start
void start()
Start worker thread pool.
Definition:
ServerWorkerThreadPool.cpp:22
tdme::network::udpserver::ServerWorkerThreadPool::stop
void stop()
Stop worker thread pool.
Definition:
ServerWorkerThreadPool.cpp:30
tdme::network::udpserver::ServerWorkerThreadPool::workerCount
unsigned int workerCount
Definition:
ServerWorkerThreadPool.h:52
tdme::network::udpserver::ServerWorkerThreadPool::ServerWorkerThreadPool
ServerWorkerThreadPool(Barrier *startUpBarrier, const unsigned int workerCount, const unsigned int maxElements)
Public constructor.
Definition:
ServerWorkerThreadPool.cpp:10
tdme::network::udpserver::ServerWorkerThreadPool::startUpBarrier
Barrier * startUpBarrier
Definition:
ServerWorkerThreadPool.h:51
tdme::network::udpserver::ServerWorkerThread
Server worker thread.
Definition:
ServerWorkerThread.h:21
tdme::os::threading::Barrier
Barrier implementation.
Definition:
Barrier.h:21
tdme::os::threading::Queue
Consumer/producer queue.
Definition:
Queue.h:24
tdme::os::threading::Queue< ServerRequest >::maxElements
unsigned int maxElements
Definition:
Queue.h:98
tdme
Definition:
fwd-tdme.h:4
tdme.h
Generated by
1.9.3