Initial Commit
This commit is contained in:
commit
c13016275b
41 changed files with 3596 additions and 0 deletions
26
headers/VUtils/Pool.h
Normal file
26
headers/VUtils/Pool.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
|
||||
namespace VUtils {
|
||||
struct PoolWorker {
|
||||
virtual void run() = 0;
|
||||
};
|
||||
|
||||
class Pool {
|
||||
public:
|
||||
explicit Pool(const char *name);
|
||||
~Pool();
|
||||
void setThreadCount(int count);
|
||||
void create(PoolWorker& worker);
|
||||
void joinFirstThread();
|
||||
protected:
|
||||
bool m_isCreated = false;
|
||||
int m_count = 1;
|
||||
const char *m_name = "Pool";
|
||||
PoolWorker *m_worker{};
|
||||
std::thread *m_threads{};
|
||||
void execute();
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue