You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AsyncAutoResetEvent runEvent = new();
await Task.WhenAny(runEvent.WaitAsync(), Task.Delay(TimeSpan.FromSeconds(1)));
runEvent.Set(); // This doesn't set runEvent.IsSet to true and the following line doesn't return immediately
await Task.WhenAny(runEvent.WaitAsync(), Task.Delay(TimeSpan.FromSeconds(5)));
The text was updated successfully, but these errors were encountered:
This is how auto-reset events work: when they become set, they release all waiters and immediately become unset again. Did you perhaps want to use a manual-reset event?
I think I know how auto-reset events work, but I guess I don't know Task.WhenAny.
When the task from WhenAny completes because of Task.Delay, the runEvent.WaitAsync()-task is alive, but "abandoned" and it's the abandoned task that gets signaled.
I think I get it now. Thank you for your response.
The text was updated successfully, but these errors were encountered: