event Class

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

A manual reset event which is explicitly aware of the Concurrency Runtime.

Syntax

class event;

Members

Public Constructors

NameDescription
event::~event DestructorDestroys an event.

Public Methods

NameDescription
event::reset MethodResets the event to a non-signaled state.
event::set MethodSignals the event.
event::wait MethodWaits for the event to become signaled.
event::wait_for_multiple MethodWaits for multiple events to become signaled.

Public Constants

NameDescription
event::timeout_infinite ConstantValue indicating that a wait should never time out.
Remarks

For more information, see Synchronization Data Structures.

Inheritance Hierarchy

event

Requirements

Header: concrt.h

Namespace: concurrency

event::event Constructor

Constructs a new event.

_CRTIMP event();

Remarks

event::~event Destructor

Destroys an event.

~event();

Remarks

It is expected that there are no threads waiting on the event when the destructor runs. Allowing the event to destruct with threads still waiting on it results in undefined behavior.

event::reset Method

Resets the event to a non-signaled state.

void reset();

event::set Method

Signals the event.

void set();

Remarks

Signaling the event can cause an arbitrary number of contexts waiting on the event to become runnable.

event::timeout_infinite Constant

Value indicating that a wait should never time out.

static const unsigned int timeout_infinite = COOPERATIVE_TIMEOUT_INFINITE;

event::wait Method

Waits for the event to become signaled.

size_t wait(unsigned int _Timeout = COOPERATIVE_TIMEOUT_INFINITE);

Parameters

_Timeout
Indicates the number of milliseconds before the wait times out. The value COOPERATIVE_TIMEOUT_INFINITE signifies that there is no timeout.

Return Value

If the wait was satisfied, the value 0 is returned; otherwise, the value COOPERATIVE_WAIT_TIMEOUT to indicate that the wait timed out without the event becoming signaled.

System_CAPS_ICON_important.jpg Important

In a Windows 8.x Store app, do not call wait on the ASTA thread because this call can block the current thread and can cause the app to become unresponsive.

event::wait_for_multiple Method

Waits for multiple events to become signaled.

static size_t __cdecl wait_for_multiple(
    _In_reads_(count) event** _PPEvents,
    size_t count,
    bool _FWaitAll,
    unsigned int _Timeout = COOPERATIVE_TIMEOUT_INFINITE);

Parameters

_PPEvents
An array of events to wait on. The number of events within the array is indicated by the count parameter.

count
The count of events within the array supplied in the _PPEvents parameter.

_FWaitAll
If set to the value true, the parameter specifies that all events within the array supplied in the _PPEvents parameter must become signaled in order to satisfy the wait. If set to the value false, it specifies that any event within the array supplied in the _PPEvents parameter becoming signaled will satisfy the wait.

_Timeout
Indicates the number of milliseconds before the wait times out. The value COOPERATIVE_TIMEOUT_INFINITE signifies that there is no timeout.

Return Value

If the wait was satisfied, the index within the array supplied in the _PPEvents parameter which satisfied the wait condition; otherwise, the value COOPERATIVE_WAIT_TIMEOUT to indicate that the wait timed out without the condition being satisfied.

Remarks

If the parameter _FWaitAll is set to the value true to indicate that all events must become signaled to satisfy the wait, the index returned by the function carries no special significance other than the fact that it is not the value COOPERATIVE_WAIT_TIMEOUT.

System_CAPS_ICON_important.jpg Important

In a Windows 8.x Store app, do not call wait_for_multiple on the ASTA thread because this call can block the current thread and can cause the app to become unresponsive.

See Also

concurrency Namespace

Related help topics
Loading...
No resources were found.