示例#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);
         }
     }
 }