示例#1
0
            public async Task <DelayResponse> DelayAsync(TimeSpan delay, CancellationTokenProxy token)
            {
                try
                {
                    await Task.Delay(delay, token).ConfigureAwait(false);
                }
                catch (TaskCanceledException ex) when(ex.CancellationToken == token)
                {
                }

                return(new DelayResponse
                {
                    IsCanceled = token.IsCancellationRequested,
                    TokenCanBeCanceled = token.CanBeCanceled
                });
            }
示例#2
0
            public async Task <DelayResponse> DelayAsync(TimeSpan delay, CancellationTokenProxy token)
            {
                WaitForOperationStarted.Set();

                var result = new DelayResponse
                {
                    Delay = delay,
                    TokenCanBeCanceled = token.Token.CanBeCanceled
                };

                try
                {
                    await Task.Delay(delay, token).ConfigureAwait(false);
                }
                catch (Exception ex)
                {
                    result.IsFaulted        = true;
                    result.ExceptionType    = ex.GetType().AssemblyQualifiedName;
                    result.ExceptionMessage = ex.ToString();
                }

                result.IsCanceled = token.Token.IsCancellationRequested;
                return(result);
            }
示例#3
0
 public Task Method(CancellationTokenProxy token)
 {
     throw new NotImplementedException();
 }
示例#4
0
 public bool PassCancellationTokenProxy(CancellationTokenProxy token)
 {
     return(Channel.PassCancellationTokenProxy(token));
 }
示例#5
0
 public Task <DelayResponse> DelayAsync(TimeSpan delay, CancellationTokenProxy token)
 {
     return(Channel.DelayAsync(delay, token));
 }
示例#6
0
 public bool PassCancellationTokenProxy(CancellationTokenProxy token)
 {
     return(token.Token.CanBeCanceled);
 }