blob: bb39d86fdc01708ad5f89f11bac5c786ab32ad59 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
//+-------------------------------------------------------------------
//
// File: cevent.hxx
//
// Contents: Definition of classes handling win32 events
//
// Classes: CEvent
//
// Functions: none
//
// History: 27-Jul-92 Rickhi Created
// 31-Dec-93 ErikGav Chicago port
//
//--------------------------------------------------------------------
#ifndef __CEVENT_HXX__
#define __CEVENT_HXX__
//+-------------------------------------------------------------------------
//
// Class: CEvent (ev)
//
// Purpose: C++ wrapper for win32 events
//
// Interface: CEvent -- creates/opens the event
// ~CEvent -- closes the event handle
// Wait -- waits for event object to be signaled
// Signal -- signals the event object
// Reset -- resets the event object
// GetName -- returns ptr to the event name
//
// History: 27-Jul-92 Rickhi Created
//
//--------------------------------------------------------------------------
class CEvent
{
public:
CEvent(LPTSTR ptszEventName,
HRESULT& hr,
BOOL fManualReset = FALSE);
~CEvent(void);
INT Wait(ULONG ulTimeOut);
void Signal(void);
void Reset(void);
private:
HANDLE _hdl; // event object handle
};
//+-------------------------------------------------------------------------
//
// Member: CEvent::~CEvent
//
// Synopsis: Destructor for event object. Closes the event handle.
//
// Arguments: none
//
// History: 27-Jul-92 Rickhi Created
//
//--------------------------------------------------------------------------
inline CEvent::~CEvent(void)
{
if (_hdl != NULL)
{
CloseHandle(_hdl);
}
}
//+-------------------------------------------------------------------------
//
// Member: CEvent::Signal
//
// Synopsis: Signals the event object.
//
// Arguments: none
//
// History: 27-Jul-92 Rickhi Created
//
//--------------------------------------------------------------------------
inline void CEvent::Signal(void)
{
int rc = SetEvent(_hdl);
Win4Assert(rc);
}
//+-------------------------------------------------------------------------
//
// Member: CEvent::Reset
//
// Synopsis: Resets the event object.
//
// Arguments: none
//
// History: 26-Sep -95 BruceMa Created
//
//--------------------------------------------------------------------------
inline void CEvent::Reset(void)
{
int rc = ResetEvent(_hdl);
Win4Assert(rc);
}
#endif // __CEVENT_HXX__
|