コード例 #1
0
            internal YieldAndNotifyAwaiter(INotifyCompletion baseAwaiter, AsyncManualResetEvent yieldingSignal, AsyncManualResetEvent resumingSignal)
            {
                Requires.NotNull(baseAwaiter, nameof(baseAwaiter));

                this.baseAwaiter    = baseAwaiter;
                this.yieldingSignal = yieldingSignal;
                this.resumingSignal = resumingSignal;
            }
コード例 #2
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
コード例 #3
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);
     }
 }
コード例 #4
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)
 {
     m_builder.TrueAwaitOnCompleted(awaiter, stateMachine);
 }
コード例 #5
0
        /// <summary>
        /// Forces an awaitable to yield, setting signals after the continuation has been pended and when the continuation has begun execution.
        /// </summary>
        /// <param name="baseAwaiter">The awaiter to extend.</param>
        /// <param name="yieldingSignal">The signal to set after the continuation has been pended.</param>
        /// <param name="resumingSignal">The signal to set when the continuation has been invoked.</param>
        /// <returns>A new awaitable.</returns>
        internal static YieldAndNotifyAwaitable YieldAndNotify(this INotifyCompletion baseAwaiter, AsyncManualResetEvent yieldingSignal = null, AsyncManualResetEvent resumingSignal = null)
        {
            Requires.NotNull(baseAwaiter, nameof(baseAwaiter));

            return(new YieldAndNotifyAwaitable(baseAwaiter, yieldingSignal, resumingSignal));
        }
コード例 #6
0
 private void AwaitOnCompleted(INotifyCompletion awaiter, IAsyncStateMachine stateMachine)
 {
     awaiter.OnCompleted(() => stateMachine.MoveNext());
 }
コード例 #7
0
 public static void NoWarning(this INotifyCompletion task)
 {
 }
コード例 #8
0
ファイル: TotemAwaitable.cs プロジェクト: Alxandr/IronTotem
 public Awaiter(Func<object, bool> isCompleted, Func<object, object> getResult, INotifyCompletion inner)
 {
     _isCompleted = isCompleted;
     _getResult = getResult;
     _inner = inner;
 }
コード例 #9
0
ファイル: TotemAwaitable.cs プロジェクト: Alxandr/IronTotem
 public TotemInternalAwaitable(Func<object, bool> isCompleted, Func<object, object> getResult, INotifyCompletion inner)
 {
     _awaiter = new Awaiter(isCompleted, getResult, inner);
 }
コード例 #10
0
 void AwaitUnsafeOnCompleted(INotifyCompletion awaiter, IAsyncStateMachine stateMachine)
 {
     base.AwaitUnsafeOnCompleted(awaiter, stateMachine);
 }
コード例 #11
0
 // AsyncMethodBuilder
 public void AwaitOnCompleted(INotifyCompletion awaiter, IAsyncStateMachine stateMachine)
 {
     awaiter.OnCompleted(stateMachine.MoveNext);
 }