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