flat pool
This commit is contained in:
parent
7aa1a28a46
commit
470bf21c43
1 changed files with 19 additions and 0 deletions
|
@ -1,6 +1,11 @@
|
||||||
#ifndef SOSC_POOL_H
|
#ifndef SOSC_POOL_H
|
||||||
#define SOSC_POOL_H
|
#define SOSC_POOL_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
|
#include <thread>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
namespace sosc {
|
namespace sosc {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class Pool {
|
class Pool {
|
||||||
|
@ -9,7 +14,21 @@ public:
|
||||||
protected:
|
protected:
|
||||||
virtual void ProcessClient(T* client) = 0;
|
virtual void ProcessClient(T* client) = 0;
|
||||||
private:
|
private:
|
||||||
|
class Stack {
|
||||||
|
public:
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::thread thread;
|
||||||
|
std::list<T*> clients;
|
||||||
|
std::mutex clients_mtx;
|
||||||
|
Pool<T> *pool;
|
||||||
|
|
||||||
|
friend class Pool<T>;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<Stack> stacks;
|
||||||
|
|
||||||
|
friend class Stack;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue