00001 #ifndef ABUSE_EVENT_H 00002 #define ABUSE_EVENT_H 00003 #include <abuse/abuse.h> 00004 #include <abuse/RefCounted.h> 00005 #include <abuse/Handle.h> 00006 #ifndef WIN32 00007 #include <abuse/CriticalSection.h> 00008 #endif 00009 #include <abuse/SysError.h> 00010 #include <abuse/WaitableObject.h> 00011 00012 class Event:public WaitableObject 00013 { 00014 public: 00015 Event(bool b=false)throw(SysError); 00016 virtual ~Event(); 00017 CONDVARPTR handle()const; 00018 void set()throw(SysError); 00019 void reset()throw(SysError); 00020 void flip()throw(SysError); 00021 virtual bool wait(DWORD dwMillis=INFINITE)const; 00022 operator bool()const; 00023 virtual bool isSet()const; 00024 void operator=(bool b); 00025 protected: 00026 RefCounted<Handle> m_handle; 00027 #ifndef WIN32 00028 mutable RefCounted<CriticalSection> m_mutex; 00029 bool m_bSignaled; 00030 #endif 00031 }; 00032 00033 #endif //ABUSE_EVENT_H