| Line | |
|---|
| 1 | #ifndef MTHREAD_H
|
|---|
| 2 | #define MTHREAD_H
|
|---|
| 3 |
|
|---|
| 4 | #ifdef __CINT__
|
|---|
| 5 | typedef unsigned long int pthread_t;
|
|---|
| 6 | #else
|
|---|
| 7 | #include <pthread.h>
|
|---|
| 8 | #endif
|
|---|
| 9 |
|
|---|
| 10 | class MThread
|
|---|
| 11 | {
|
|---|
| 12 | private:
|
|---|
| 13 | bool fIsRunning;
|
|---|
| 14 | bool fIsDetached;
|
|---|
| 15 | bool fStop;
|
|---|
| 16 |
|
|---|
| 17 | pthread_t *fThread;
|
|---|
| 18 |
|
|---|
| 19 | void *fReturn;
|
|---|
| 20 |
|
|---|
| 21 | int fPriority;
|
|---|
| 22 |
|
|---|
| 23 | static void *MapThread(void *arg);
|
|---|
| 24 | void *RunThread();
|
|---|
| 25 | virtual void *Thread() = 0;
|
|---|
| 26 |
|
|---|
| 27 | public:
|
|---|
| 28 | MThread(bool start=true);
|
|---|
| 29 | virtual ~MThread();
|
|---|
| 30 |
|
|---|
| 31 | bool SetPriority(int prio);
|
|---|
| 32 |
|
|---|
| 33 | void Detach();
|
|---|
| 34 |
|
|---|
| 35 | void Start();
|
|---|
| 36 | void Stop();
|
|---|
| 37 |
|
|---|
| 38 | bool HasStopFlag() const { return fStop; }
|
|---|
| 39 | };
|
|---|
| 40 |
|
|---|
| 41 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.