Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef THREADENGINE_H
00014 #define THREADENGINE_H
00015
00016 #include "sockets.h"
00017 #include "extensible.h"
00018
00019 class CoreExport Thread : public Pipe, public Extensible
00020 {
00021 private:
00022
00023 bool exit;
00024
00025 public:
00026
00027 pthread_t handle;
00028
00031 Thread();
00032
00035 virtual ~Thread();
00036
00039 void Join();
00040
00043 void SetExitState();
00044
00047 void Exit();
00048
00051 void Start();
00052
00056 bool GetExitState() const;
00057
00060 void OnNotify();
00061
00064 virtual void Run() = 0;
00065 };
00066
00067 class CoreExport Mutex
00068 {
00069 protected:
00070
00071 pthread_mutex_t mutex;
00072
00073 public:
00076 Mutex();
00077
00080 ~Mutex();
00081
00084 void Lock();
00085
00088 void Unlock();
00089
00094 bool TryLock();
00095 };
00096
00097 class CoreExport Condition : public Mutex
00098 {
00099 private:
00100
00101 pthread_cond_t cond;
00102
00103 public:
00106 Condition();
00107
00110 ~Condition();
00111
00114 void Wakeup();
00115
00118 void Wait();
00119 };
00120
00121 #endif // THREADENGINE_H