## CAMEvent Class

The CAMEvent class is an event object that can be set and waited on to provide interthread synchronization. This is currently implemented by using the Microsoft® Win32® Event application programming interfaces (APIs).

Events can be created as manual-reset or automatic-reset, and will always be created as not set (nonsignaled state). They can also be cast to handles so as to be passed to the Win32 WaitForMultipleObjects function.

Protected Data Members

Name | Description
m_hEvent | Microsoft Win32 event handle.

Member Functions

Name | Description
CAMEvent | Constructs a CAMEvent object.
Check | Returns TRUE if the event is currently set, but does not block.
Reset | Forces the event into a nonsignaled state.
Set | Puts the event into a signaled state.
Wait | Blocks until the event is signaled, or until an optional time-out occurs.
operator HANDLE | Gets the HANDLE object.

###

CAMEvent::CAMEvent

CAMEvent Class

Constructs a CAMEvent object.

CAMEvent(
BOOL fManualReset = FALSE
);

##### Parameters

fManualReset
  If this value is FALSE, the event is reset when the CAMEvent::Wait member function completes. If this parameter is TRUE, you can set the event by calling the CAMEvent::Set member function and then reset it by calling the CAMEvent::Reset member function.

##### Return Values

No return value.

###

CAMEvent::Check

CAMEvent Class

Returns TRUE if the event is currently set, but does not block.

BOOL Check(void);

##### Remarks

For events that are not manual-reset events, this member function causes the event to enter a nonsignaled state.

###

CAMEvent::Reset

CAMEvent Class

Forces the event into a nonsignaled state.

void Reset(void);

##### Return Values

No return value.

###

CAMEvent::Set

CAMEvent Class

Puts the event into a signaled state.

void Set(void);

##### Return Values

No return value.

##### Remarks

If the event is not a manual-reset event and there is at least one thread blocked on this event, the thread is released and the event remains in a nonsignaled state. If the event is not a manual-reset event and no threads are blocked on the event, it is set to a signaled state.

If the event is not a manual-reset event, it is set to a signaled state and all the threads blocked on this event are released.

###

CAMEvent::Wait

CAMEvent Class

Blocks until the event is signaled, or until the indicated time-out occurs.

BOOL Wait(
DWORD dwTimeout
);

##### Parameters

dwTimeout
  Optional time-out value, represented in milliseconds. The default is INFINITE.

##### Return Values

Returns TRUE if the event becomes signaled; otherwise, returns FALSE.

##### Remarks

For events that are not manual-reset events, the action completing the CAMEvent::Wait member function causes the event to enter a nonsignaled state until the CAMEvent::Set member function is called.

###

CAMEvent::operator HANDLE

CAMEvent Class

Gets the HANDLE object associated with this CAMEvent object.

    operator HANDLE () const;

##### Return Values

Returns the Microsoft Win32 event HANDLE.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.