Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WaiterCompletionSource"/> class.
 /// </summary>
 /// <param name="owner">The event that is initializing this value.</param>
 /// <param name="cancellationToken">The cancellation token associated with the waiter.</param>
 /// <param name="allowInliningContinuations"><c>true</c> to allow continuations to be inlined upon the completer's callstack.</param>
 public WaiterCompletionSource(AsyncAutoResetEvent owner, CancellationToken cancellationToken, bool allowInliningContinuations)
     : base(allowInliningContinuations)
 {
     this.CancellationToken = cancellationToken;
     this.Registration      = cancellationToken.Register(owner.onCancellationRequestHandler, this);
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WaiterCompletionSource"/> class.
 /// </summary>
 /// <param name="owner">The event that is initializing this value.</param>
 /// <param name="allowInliningContinuations"><c>true</c> to allow continuations to be inlined upon the completer's callstack.</param>
 /// <param name="cancellationToken">The cancellation token associated with the waiter.</param>
 internal WaiterCompletionSource(AsyncAutoResetEvent owner, bool allowInliningContinuations, CancellationToken cancellationToken)
     : base(allowInliningContinuations)
 {
     this.CancellationToken = cancellationToken;
     this.Registration      = cancellationToken.Register(NullableHelpers.AsNullableArgAction(owner.onCancellationRequestHandler), this);
 }