Alexandre Lision | 7fd5d3d | 2013-12-04 13:06:40 -0500 | [diff] [blame] | 1 | // |
| 2 | // EventClass.h: header file |
| 3 | // |
| 4 | // Copyright (C) Walter E. Capers. All rights reserved |
| 5 | // |
| 6 | // This source is free to use as you like. If you make |
| 7 | // any changes please keep me in the loop. Email them to |
| 8 | // walt.capers@comcast.net. |
| 9 | // |
| 10 | // PURPOSE: |
| 11 | // |
| 12 | // To implement event signals as a C++ object |
| 13 | // |
| 14 | // REVISIONS |
| 15 | // ======================================================= |
| 16 | // Date: 10.25.07 |
| 17 | // Name: Walter E. Capers |
| 18 | // Description: File creation |
| 19 | // |
| 20 | // Date: |
| 21 | // Name: |
| 22 | // Description: |
| 23 | // |
| 24 | // |
| 25 | #ifndef EVENT_CLASS |
| 26 | #define EVENT_CLASS |
| 27 | |
| 28 | class CEventClass |
| 29 | { |
| 30 | private: |
| 31 | ThreadId_t m_owner; |
| 32 | #ifdef WINDOWS |
| 33 | HANDLE m_event; |
| 34 | #else |
| 35 | pthread_cond_t m_ready; |
| 36 | pthread_mutex_t m_lock; |
| 37 | #endif |
| 38 | public: |
| 39 | BOOL e_timeout; |
| 40 | BOOL m_bCreated; |
| 41 | void Set(); |
| 42 | BOOL Wait(DWORD tmout =0); |
| 43 | void Reset(); |
| 44 | CEventClass(void); |
| 45 | ~CEventClass(void); |
| 46 | }; |
| 47 | |
| 48 | #endif |
| 49 | |