Critical Link MityCam SoC Firmware  1.0
Critical Link MityCam SoC Firmware
Thread.h
Go to the documentation of this file.
1 #ifndef THREAD_H
2 #define THREAD_H
3 
4 #include <pthread.h>
5 
6 class tcThread
7 {
8 public:
9 // Linux/Unix has inverted priorities:
10  static const int HIGHEST_PRIORITY = -2;
11  static const int HIGH_PRIORITY = -1;
12  static const int NORMAL_PRIORITY = 0;
13  static const int LOW_PRIORITY = 1;
14  static const int LOWEST_PRIORITY = 2;
15 
21  tcThread();
22  virtual ~tcThread();
23 
27  void join();
28 
32  virtual void start();
33 
39  virtual void stop();
40 
46  virtual void* run() = 0;
47 
48 protected:
53  void setPriority(int anRelativePriority);
54 
55  // Flag which will be set when stop() is called.
57 
58 private:
62  static void* pthread_entry(void* apSelf);
63 
64  // pthread id for this thread.
65  pthread_t mhThread;
66 };
67 
68 #endif // THREAD_H
tcThread::HIGH_PRIORITY
static const int HIGH_PRIORITY
Definition: Thread.h:11
tcThread::~tcThread
virtual ~tcThread()
Definition: Thread.cpp:12
tcThread::start
virtual void start()
Definition: Thread.cpp:21
tcThread::run
virtual void * run()=0
tcThread::NORMAL_PRIORITY
static const int NORMAL_PRIORITY
Definition: Thread.h:12
tcThread::tcThread
tcThread()
Definition: Thread.cpp:6
tcThread::HIGHEST_PRIORITY
static const int HIGHEST_PRIORITY
Definition: Thread.h:10
tcThread
Definition: Thread.h:6
tcThread::LOWEST_PRIORITY
static const int LOWEST_PRIORITY
Definition: Thread.h:14
tcThread::stop
virtual void stop()
Definition: Thread.cpp:30
tcThread::LOW_PRIORITY
static const int LOW_PRIORITY
Definition: Thread.h:13
tcThread::setPriority
void setPriority(int anRelativePriority)
Definition: Thread.cpp:35
tcThread::join
void join()
Definition: Thread.cpp:16
tcThread::mbKillThread
bool mbKillThread
Definition: Thread.h:56