xtd 0.2.0
Loading...
Searching...
No Matches

◆ set()

bool xtd::threading::event_wait_handle::set ( )

Sets the state of the event to signaled, allowing one or more waiting threads to proceed.

Returns
true if the operation succeeds; otherwise, false.
Exceptions
xtd::object_closed_exceptionThe xtd::threading::wait_handle::close() method was previously called on this xtd::threading::event_wait_handle.
Remarks
For an xtd::threading::event_wait_handle with xtd::threading::event_reset_mode::auto_reset (including xtd::threading:::auto_reset_event), the xtd::threading::event_wait_handle::set method releases a single thread. If there are no waiting threads, the wait handle remains signaled until a thread attempts to wait on it, or until its xtd::threading::event_wait_handle::reset method is called.
Warning
There is no guarantee that every call to the xtd::threading::auto_reset_event::set method will release a thread. If two calls are too close together, so that the second call occurs before a thread has been released, only one thread is released. It's as if the second call did not happen. Also, if xtd::threading::auto_reset_event::set is called when there are no threads waiting and the xtd::threading::auto_reset_event is already signaled, the call has no effect.
Remarks
For an xtd::threading::event_wait_handle with xtd::threading::event_reset_mode::manual_reset (including xtd::threading:::manual_reset_event), calling the Set method leaves the wait handle in a signaled state until its xtd::threading::event_wait_handle::reset method is called.
Examples
event_wait_handle.cpp.