modified: SpatialOmicsCoord.py
[GalaxyCodeBases.git] / BGI / SOAPsnp / ThreadManager.h
blobb7040f0325107b40d819a28b986ca098a312057d
1 #include<vector>
2 #include<unistd.h>
3 #include<pthread.h>
4 #include<sys/time.h>
6 using namespace std;
8 #ifndef _THREADMANAGER_H_
9 #define _THREADMANAGER_H_
11 typedef void* (*pthreadproc)(void*);
13 class ThreadManager
15 public:
16 ThreadManager();
17 ThreadManager(int cpu);
18 ~ThreadManager();
20 void AddThread(pthreadproc pProc, void* param);
21 void Run();
22 void SetTimer(float t = 0.5);
23 void Reset();
24 void SetCPU(int count);
25 private:
26 public:
27 vector<pthreadproc> m_vproc;
28 vector<void*> m_vparam;
29 int m_cpu;
30 int m_nmaxthread;
31 int m_nindex;
33 protected:
34 private:
35 float m_ftimer;
38 // ThreadParam
39 struct THRPARAM
41 ThreadManager* pMgr;
42 int flag;
45 #endif