CAMEvent Class

CAMEvent class hierarchy

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

m_hEvent Microsoft Win32 event handle.

Member Functions

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.

Syntax

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 Value

No return value.

CAMEvent::Check

CAMEvent Class

Checks to see if the event is currently set.

Syntax

BOOL Check(void);

Remarks

Returns TRUE if the event is currently set, but does not block. 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.

Syntax

void Reset(void);

Return Value

No return value.

CAMEvent::Set

CAMEvent Class

Puts the event into a signaled state.

Syntax

void Set(void);

Return Value

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.

Syntax

BOOL Wait(
    DWORD dwTimeout = INFINITE
    );

Parameters

dwTimeout
Optional time-out value, represented in milliseconds.

Return Value

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.

Syntax

operator HANDLE () const;

Return Value

Returns the Microsoft Win32 event HANDLE.


Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.