From: Stephen Toub Date: Tue, 4 Dec 2018 16:30:19 +0000 (-0500) Subject: Delete dead code in Task X-Git-Tag: accepted/tizen/unified/20190422.045933~453^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=85f2d14b0c5c44f5669e50d3d6486fa9500aa103;p=platform%2Fupstream%2Fcoreclr.git Delete dead code in Task --- diff --git a/src/System.Private.CoreLib/src/System/Threading/Tasks/future.cs b/src/System.Private.CoreLib/src/System/Threading/Tasks/future.cs index 29309c6..86a6af7 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Tasks/future.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Tasks/future.cs @@ -66,9 +66,6 @@ namespace System.Threading.Tasks [DebuggerTypeProxy(typeof(SystemThreadingTasks_FutureDebugView<>))] [DebuggerDisplay("Id = {Id}, Status = {Status}, Method = {DebuggerDisplayMethodDescription}, Result = {DebuggerDisplayResultDescription}")] public class Task : Task -#if SUPPORT_IOBSERVABLE - , IObservable -#endif { internal TResult m_result; // The value itself, if set. @@ -1465,75 +1462,8 @@ namespace System.Threading.Tasks #endregion #endregion - -#if SUPPORT_IOBSERVABLE - /// - /// Subscribes an to receive notification of the final state of this . - /// - /// - /// The to call on task completion. If this Task throws an exception, - /// observer.OnError is called with this Task's AggregateException. If this Task RanToCompletion, - /// observer.OnNext is called with this Task's result, followed by a call to observer.OnCompleted. - /// If this Task is Canceled, observer.OnError is called with a TaskCanceledException - /// containing this Task's CancellationToken - /// - /// An IDisposable object . - /// - /// The argument is null. - /// - IDisposable IObservable.Subscribe(IObserver observer) - { - if (observer == null) - ThrowHelper.ThrowArgumentNullException(ExceptionArgument.observer); - - - var continuationTask = - this.ContinueWith(delegate(Task observedTask, object taskObserverObject) - { - IObserver taskObserver = (IObserver)taskObserverObject; - if (observedTask.IsFaulted) - taskObserver.OnError(observedTask.Exception); - else if (observedTask.IsCanceled) - taskObserver.OnError(new TaskCanceledException(observedTask)); - else - { - taskObserver.OnNext(observedTask.Result); - taskObserver.OnCompleted(); - } - - }, observer, TaskScheduler.Default); - - return new DisposableSubscription(this, continuationTask); - } -#endif } -#if SUPPORT_IOBSERVABLE - // Class that calls RemoveContinuation if Dispose() is called before task completion - internal class DisposableSubscription : IDisposable - { - private Task _notifyObserverContinuationTask; - private Task _observedTask; - - internal DisposableSubscription(Task observedTask, Task notifyObserverContinuationTask) - { - _observedTask = observedTask; - _notifyObserverContinuationTask = notifyObserverContinuationTask; - } - void IDisposable.Dispose() - { - Task localObservedTask = _observedTask; - Task localNotifyingContinuationTask = _notifyObserverContinuationTask; - if (localObservedTask != null && localNotifyingContinuationTask != null && !localObservedTask.IsCompleted) - { - localObservedTask.RemoveContinuation(localNotifyingContinuationTask); - } - _observedTask = null; - _notifyObserverContinuationTask = null; - } - } -#endif - // Proxy class for better debugging experience internal class SystemThreadingTasks_FutureDebugView {