private void InvokeContinuation()
        {
            object cc = _capturedContext;

            _capturedContext = null;

            switch (cc)
            {
            case null:
                _continuation(_continuationState);
                break;

            case SynchronizationContext sc:
                sc.Post(s =>
                {
                    ref ManualResetValueTaskSourceLogic <TResult> logicRef = ref ((IStrongBox <ManualResetValueTaskSourceLogic <TResult> >)s).Value;
                    logicRef._continuation(logicRef._continuationState);
                }, _parent ?? throw new InvalidOperationException());
예제 #2
0
 public ManualResetValueTaskSource(ContinuationOptions options = ContinuationOptions.None)
 {
     _logic = new ManualResetValueTaskSourceLogic <T>(this, options);
     _cancellationCallback = SetCanceled;
 }
 public CountAsyncEnumerable(int items)
 {
     _local_items = _param_items = items;
     _vts         = new ManualResetValueTaskSourceLogic <bool>(this);
 }