Closed kakkamstrup closed 9 months ago
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.
Ah. Yes, your description is correct: the task previously returned from WaitAsync
is completed (but is ignored by the calling code).