コード例 #1
0
 private async void StartFoo()
 {
     await Task.Factory.StartNew(() =>
     {
         while (State != FooState.Finished)
         {
             IResult result = CurrentBar.WaitForValue();     // This is blocking function, wait for a value
             OnValueInjected?.Invoke(this, new ResultEventArgs(result));
             AutoReset.Set();
             // .. rest of the loop
         }
     });
 }