示例#1
0
 public AsyncManualResetEvent(bool set)
 {
     _mutex = new object();
     _tcs   = TaskCompletionSourceExtensions.CreateAsyncTaskSource <object>();
     if (set)
     {
         _tcs.TrySetResult(null !);
     }
 }
示例#2
0
 public void Reset()
 {
     lock (_mutex)
     {
         if (_tcs.Task.IsCompleted)
         {
             _tcs = TaskCompletionSourceExtensions.CreateAsyncTaskSource <object>();
         }
     }
 }