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