thick pools
This commit is contained in:
parent
0115909d4f
commit
36def513b0
1 changed files with 11 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
#ifndef SOSC_POOL_H
|
||||
#define SOSC_POOL_H
|
||||
|
||||
#include <numeric>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <thread>
|
||||
|
@ -33,6 +34,8 @@ public:
|
|||
|
||||
void Start();
|
||||
bool AddClient(T* client);
|
||||
int ClientCount() const;
|
||||
|
||||
void Stop();
|
||||
protected:
|
||||
virtual void ProcessClient(T* client) = 0;
|
||||
|
@ -86,6 +89,14 @@ bool Pool<T>::AddClient(T* client) {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
int Pool<T>::ClientCount() const {
|
||||
int count = 0;
|
||||
for(auto i = this->stacks.begin(); i != this->stacks.end(); ++i)
|
||||
count += i->ClientCount();
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue