thick pools

This commit is contained in:
malloc 2018-04-13 08:36:54 -05:00
parent 0115909d4f
commit 36def513b0

View file

@ -1,6 +1,7 @@
#ifndef SOSC_POOL_H #ifndef SOSC_POOL_H
#define SOSC_POOL_H #define SOSC_POOL_H
#include <numeric>
#include <vector> #include <vector>
#include <list> #include <list>
#include <thread> #include <thread>
@ -33,6 +34,8 @@ public:
void Start(); void Start();
bool AddClient(T* client); bool AddClient(T* client);
int ClientCount() const;
void Stop(); void Stop();
protected: protected:
virtual void ProcessClient(T* client) = 0; virtual void ProcessClient(T* client) = 0;
@ -86,6 +89,14 @@ bool Pool<T>::AddClient(T* client) {
return false; 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 #endif