forked from augcampos/asterisk-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThread.h
More file actions
39 lines (29 loc) · 742 Bytes
/
Thread.h
File metadata and controls
39 lines (29 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* Thread.h
*
* Created on: Jul 7, 2011
* Author: augcampos
*/
#ifndef THREAD_H_
#define THREAD_H_
#include <boost/thread.hpp>
namespace asteriskcpp {
class Thread {
public:
Thread();
virtual ~Thread();
virtual void start();
virtual void stop();
virtual void run();
virtual void operator ()();
protected:
void setMustStop(volatile bool stop);
bool isStoped();
private:
boost::thread* m_thread; // The thread runs this object
boost::mutex m_mustStopMutex;
// Variable that indicates to stop and the mutex to synchronise "must stop" on (mutex explained later)
bool m_mustStop;
};
}
#endif /* THREAD_H_ */