public AsyncManualResetEvent(bool set, T init) { _mutex = new object(); _tcs = TaskCompletionSourceExtensions.CreateAsyncTaskSource <T>(); if (set) { _tcs.TrySetResult(init); } }
public void Reset(T val) { lock (_mutex) { if (_tcs.Task.IsCompleted) { _tcs = TaskCompletionSourceExtensions.CreateAsyncTaskSource <T>(val); } } }