Function Event.unreliableWait
waits for the event to be set with potential spurious wakeups
If the event is already set, returns without sleeping.
The main difference between this method and wait is that this method supports the case where the struct holding the Event is freed while the fiber is sleeping. As a result, two main differences are possible:
- Spurious wakeups are possible (i.e. -
unreliableWait
returns, but the event is not set) - The VerboseEvent will not report when we wake up from the sleep.
Proper invocation should use the following pattern:
while( isEventValid && !event .unreliableWait ) {}
It should be pointed out that spurious wakeups only happen when another fiber sets the event. This might still be
a spurious because another fiber might reset the event before the waiting fiber gets a chance to run. If this
is a desired behavior, you might wish to check whether Signal
fits your needs better.
Parameters
Name | Description |
---|---|
timeout | sets a timeout for the wait. |
Returns
Returns true
if the event was already set when the call was made.
Throws
TimeoutExpired
if the timeout expires.
Any other exception injected to this fiber using Reactor