public void AwaitUnsafeOnCompleted <TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine { if (moveNext == null) { var runner = new MoveNextRunner <TStateMachine>(); moveNext = runner.Run; runner.StateMachine = stateMachine; // set after create delegate. } awaiter.UnsafeOnCompleted(moveNext); }
public void AwaitOnCompleted <TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine { if (moveNext == null) { var runner = new MoveNextRunner <TStateMachine>(); moveNext = runner.Run; runner.StateMachine = stateMachine; } awaiter.OnCompleted(moveNext); }
public void AwaitOnCompleted <TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine { if (moveNext == null) { if (this.tcs == null) { this.tcs = new ETTaskCompletionSource(); // built future. } var runner = new MoveNextRunner <TStateMachine>(); moveNext = runner.Run; runner.StateMachine = stateMachine; // set after create delegate. } awaiter.OnCompleted(moveNext); }