35 |
/// Abstract base class for classes that need to run in an own thread. |
/// Abstract base class for classes that need to run in an own thread. |
36 |
class Thread { |
class Thread { |
37 |
public: |
public: |
38 |
Thread(bool RealTime, int PriorityMax, int PriorityDelta); |
Thread(bool LockMemory, bool RealTime, int PriorityMax, int PriorityDelta); |
39 |
virtual ~Thread(); |
virtual ~Thread(); |
40 |
virtual int StartThread(); |
virtual int StartThread(); |
41 |
virtual int StopThread(); |
virtual int StopThread(); |
42 |
|
virtual int SignalStartThread(); |
43 |
virtual int SignalStopThread(); |
virtual int SignalStopThread(); |
44 |
virtual bool IsRunning() { return Running; } |
virtual bool IsRunning() { return Running; } |
45 |
virtual int SetSchedulingPriority(); //FIXME: should be private |
virtual int SetSchedulingPriority(); //FIXME: should be private |
46 |
|
virtual int LockMemory(); //FIXME: should be private |
47 |
virtual void EnableDestructor(); //FIXME: should be private |
virtual void EnableDestructor(); //FIXME: should be private |
48 |
virtual int Destructor(); //FIXME: should be private |
virtual int Destructor(); //FIXME: should be private |
49 |
virtual int Main() = 0; ///< This method needs to be implemented by the descendant and is the entry point for the new thread. FIXME: should be protected |
virtual int Main() = 0; ///< This method needs to be implemented by the descendant and is the entry point for the new thread. FIXME: should be protected |
51 |
pthread_t __thread_id; |
pthread_t __thread_id; |
52 |
pthread_key_t __thread_destructor_key; |
pthread_key_t __thread_destructor_key; |
53 |
pthread_mutex_t __thread_state_mutex; |
pthread_mutex_t __thread_state_mutex; |
54 |
|
pthread_cond_t __thread_start_condition; |
55 |
pthread_cond_t __thread_exit_condition; |
pthread_cond_t __thread_exit_condition; |
56 |
int PriorityMax; |
int PriorityMax; |
57 |
int PriorityDelta; |
int PriorityDelta; |
58 |
bool Running; |
bool Running; |
59 |
bool isRealTime; |
bool isRealTime; |
60 |
|
bool bLockedMemory; |
61 |
}; |
}; |
62 |
|
|
63 |
// Callback functions for the POSIX thread API |
// Callback functions for the POSIX thread API |