Microsoft DirectX 8.0 |
Wrapper class for manual-reset and auto-reset events.
Declaration: Wxutil.h
This class provides a convenient way to manage events, rather than calling Microsoft® Win32® functions such as CreateEvent, WaitForSingleObject, and ResetEvent.
Protected Member Variables | |
---|---|
m_hEvent | Event handle. |
Public Methods | |
CAMEvent | Constructor method. |
~CAMEvent | Destructor method. |
Check | Checks whether the event is set, without blocking. |
Reset | Sets the state of the event to nonsignaled. |
Set | Signals the event. |
Wait | Blocks until the event is signaled, or until a time-out occurs. |
Operators | |
HANDLE | Retrieves the event handle. |
Event handle.
Syntax
HANDLE m_hEvent;
Constructor method.
Syntax
CAMEvent( BOOL fManualReset = FALSE );
Parameters
- fManualReset
- Boolean value that specifies whether the object is a manual-reset event or an auto-reset event. If TRUE, the object is a manual-reset event. Otherwise, it is an auto-reset event.
Remarks
The event begins in a nonsignaled state.
With an auto-reset event, the CAMEvent::Wait method resets the event to nonsignaled when the method returns. With a manual-reset event, the event remains signaled until you call the CAMEvent::Reset method.
Destructor method.
Syntax
~CAMEvent(void);
Checks whether the event is set, without blocking.
Syntax
BOOL Check(void);
Remarks
Returns TRUE if the event is set, or FALSE otherwise.
Remarks
This method calls the Wait method with a time-out of zero. If the object is an auto-reset event, this method resets the event.
Sets the state of the event to nonsignaled.
Syntax
void Reset(void);
Signals the event.
Syntax
void Set(void);
Remarks
The behavior depends on whether the object is an auto-reset event or a manual-reset event:
- Auto-reset: If any threads are waiting on this event, one thread is released and the event is reset. If no threads are waiting on this event, the event remains signaled.
- Manual-reset: All the threads waiting on this event are released. The event remains signaled.
Blocks until the event is signaled, or until a time-out occurs.
Syntax
BOOL Wait( DWORD dwTimeout = INFINITE );
Parameters
- dwTimeout
- Optional time-out value, represented in milliseconds.
Return Value
Returns TRUE if the event is signaled. Otherwise, returns FALSE.
Remarks
For auto-reset events, the event is reset to a nonsignaled state when this method returns.
Retrieves the event handle. This operator is not supported as an L-value.
Syntax
operator HANDLE () const;
Return Value
Returns the m_hEvent member variable.