00001 #ifndef ABUSE_THREAD_H 00002 #define ABUSE_THREAD_H 00003 00004 #include <abuse/abuse.h> 00005 #include <abuse/SysError.h> 00006 #include <abuse/WaitableObject.h> 00007 #include <abuse/Event.h> 00008 00009 class Thread: public WaitableObject 00010 { 00011 public: 00012 Thread()throw(SysError); 00013 virtual ~Thread(); 00014 THREADHANDLE getHandle()const; 00015 void start()throw(SysError); 00016 virtual bool wait(DWORD dwMillis=INFINITE)const; 00017 virtual bool isSet()const; 00018 private: 00019 Thread(const Thread&); 00020 void operator=(Thread&); 00021 static THREADRETVALUE _threadMain(void* args); 00022 Event hEvent; 00023 00024 protected: 00025 virtual THREADRETVALUE run()=0; 00026 THREADHANDLE hThread; 00027 #ifdef WIN32 00028 DWORD dwThread; 00029 #endif 00030 }; 00031 #endif