Example #1
0
        }         // proc ProcessMessageLoop

        /// <summary>Run the message loop in the current context/thread.</summary>
        /// <param name="onCompletion"></param>
        public void ProcessMessageLoop(INotifyCompletion onCompletion)
        {
            using (var cancellationTokenSource = new CancellationTokenSource())
            {
                onCompletion.OnCompleted(cancellationTokenSource.Cancel);
                ProcessMessageLoop(cancellationTokenSource.Token);
            }
        }         // proc ProcessMessageLoop
Example #2
0
 /// <summary>
 ///     Schedules the state machine to proceed to the next action when the specified awaiter completes.
 /// </summary>
 /// <param name="awaiter">The awaiter.</param>
 /// <param name="stateMachine">The state machine.</param>
 /// <typeparam name="TAwaiter">The type of the awaiter.</typeparam>
 /// <typeparam name="TStateMachine">The type of the state machine.</typeparam>
 public void TrueAwaitOnCompleted(INotifyCompletion awaiter, IAsyncStateMachine stateMachine)
 {
     try
     {
         Action completionAction = m_coreState.GetCompletionAction(this, stateMachine);
         awaiter.OnCompleted(completionAction);
     }
     catch (Exception ex)
     {
         AsyncMethodBuilderCore.ThrowAsync(ex);
     }
 }
 private void AwaitOnCompleted(INotifyCompletion awaiter, IAsyncStateMachine stateMachine)
 {
     awaiter.OnCompleted(() => stateMachine.MoveNext());
 }
Example #4
0
 // AsyncMethodBuilder
 public void AwaitOnCompleted(INotifyCompletion awaiter, IAsyncStateMachine stateMachine)
 {
     awaiter.OnCompleted(stateMachine.MoveNext);
 }