Пример #1
0
        public Task CommitAsync(CancellationToken cancellationToken)
        {
            _committed = true;
            Task baseTask = CancellableTaskFactory.FromAsync(base.BeginCommit, base.EndCommit, cancellationToken);

            return(CommitAsyncCore(baseTask, cancellationToken));
        }
Пример #2
0
        public override ICancellableAsyncResult BeginFlush(AsyncCallback callback, object state)
        {
            CancellationTokenSource cancellationSource = new CancellationTokenSource();
            Task baseTask = CancellableTaskFactory.FromAsync(base.BeginFlush, base.EndFlush, cancellationSource.Token);

            return(new TaskCancellableAsyncResult(FlushAsyncCore(baseTask), cancellationSource, callback, state));
        }
Пример #3
0
        public override ICancellableAsyncResult BeginCommit(AsyncCallback callback, object state)
        {
            CancellationTokenSource cancellationSource = new CancellationTokenSource();

            _committed = true;
            Task baseTask = CancellableTaskFactory.FromAsync(base.BeginCommit, base.EndCommit,
                                                             cancellationSource.Token);

            return(new TaskCancellableAsyncResult(CommitAsyncCore(baseTask, cancellationSource.Token),
                                                  cancellationSource, callback, state));
        }
Пример #4
0
 public override Task FlushAsync(CancellationToken cancellationToken)
 {
     // The Storage NuGet package for .NET 4.0 can't implement FlushAsync, since that is a .NET 4.5-only method.
     // Rely on BeginFlush/EndFlush instead of FlushAsync.
     return(CancellableTaskFactory.FromAsync(_inner.BeginFlush, _inner.EndFlush, cancellationToken));
 }