11using System.Threading;
12using System.Threading.Tasks;
21 private volatile TaskCompletionSource<bool> _tcs =
new TaskCompletionSource<bool>();
31 public void Set() { _tcs.TrySetResult(
true); }
41 if (!tcs.Task.IsCompleted ||
42 Interlocked.CompareExchange(ref _tcs,
new TaskCompletionSource<bool>(), tcs) == tcs)
Async/await implementation of a ManualResetEvent
void Reset()
Reset the event, preparing it for reuse
Task WaitAsync()
Get awaitable task for the event
void Set()
Set the event, unblocking any code awaiting the event