nesca/Threader.h

31 lines
621 B
C
Raw Normal View History

2015-03-17 14:30:53 +00:00
#ifndef THREADER_H
#define THREADER_H
#include <mainResources.h>
2015-03-19 14:34:35 +00:00
#include <externData.h>
2015-03-18 14:28:39 +00:00
#include <thread>
2015-03-19 14:34:35 +00:00
#include <chrono>
#include <future>
#include <mutex>
#include <condition_variable>
2015-03-17 14:30:53 +00:00
class Threader {
2015-03-18 14:28:39 +00:00
2015-03-17 14:30:53 +00:00
private:
2015-03-18 14:28:39 +00:00
public:
static std::vector<char *> threadPool;
2015-03-19 14:34:35 +00:00
static int threadId;
static std::condition_variable cv;
static std::vector<bool> readyPool;
2015-03-17 14:30:53 +00:00
2015-03-18 14:28:39 +00:00
private:
static int getFreeDataSlotId();
static int getFreeThreadId();
2015-03-17 14:30:53 +00:00
public:
2015-03-19 14:34:35 +00:00
static void fireThread(char *st,
void* func(int,std::condition_variable*));
2015-03-18 14:28:39 +00:00
static void cleanUp();
2015-03-17 14:30:53 +00:00
};
#endif // THREADER_H