2015-03-17 14:30:53 +00:00
|
|
|
#ifndef THREADER_H
|
|
|
|
#define THREADER_H
|
|
|
|
|
|
|
|
#include <mainResources.h>
|
2015-03-18 14:28:39 +00:00
|
|
|
#include <thread>
|
2015-03-17 14:30:53 +00:00
|
|
|
|
2015-03-18 14:28:39 +00:00
|
|
|
//typedef struct {
|
|
|
|
// char argv[MAX_ADDR_LEN] = {0};
|
|
|
|
//} ST;
|
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
|
|
|
static int threadPoolSize;
|
|
|
|
static void* lFunc;
|
|
|
|
public:
|
|
|
|
static std::vector<char *> threadPool;
|
|
|
|
static bool mayRun;
|
2015-03-17 14:30:53 +00:00
|
|
|
|
2015-03-18 14:28:39 +00:00
|
|
|
private:
|
|
|
|
static int getFree();
|
|
|
|
static int getFreeDataSlotId();
|
|
|
|
static int getFreeThreadId();
|
2015-03-17 14:30:53 +00:00
|
|
|
public:
|
2015-03-18 14:28:39 +00:00
|
|
|
static void recreateThreadPool(int poolSize);
|
|
|
|
static void createThreadPool(int poolSize, void *func(int));
|
|
|
|
static void fireThread(char *st);
|
|
|
|
static void cleanUp();
|
2015-03-17 14:30:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // THREADER_H
|