From 3719f3c0b743d0e37f20337b302f28a5703148cd Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Sat, 11 Jul 2020 23:03:25 -0400 Subject: [PATCH] Remove dead SUPPORT_THREAD_ABORT code in PLINQ (#39148) --- .../AssociativeAggregationOperator.cs | 14 -------- .../Inlined/InlinedAggregationOperator.cs | 7 ---- .../Linq/Parallel/Utils/ExceptionAggregator.cs | 21 ----------- .../src/System/Linq/ParallelEnumerable.cs | 42 ---------------------- 4 files changed, 84 deletions(-) diff --git a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/AssociativeAggregationOperator.cs b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/AssociativeAggregationOperator.cs index f481be0..175aeec 100644 --- a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/AssociativeAggregationOperator.cs +++ b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/AssociativeAggregationOperator.cs @@ -126,13 +126,6 @@ namespace System.Linq.Parallel { accumulator = _finalReduce(accumulator, enumerator.Current); } -#if SUPPORT_THREAD_ABORT - catch (ThreadAbortException) - { - // Do not wrap ThreadAbortExceptions - throw; - } -#endif catch (Exception ex) { // We need to wrap all exceptions into an aggregate. @@ -166,13 +159,6 @@ namespace System.Linq.Parallel { return _resultSelector(accumulator); } -#if SUPPORT_THREAD_ABORT - catch (ThreadAbortException) - { - // Do not wrap ThreadAbortExceptions - throw; - } -#endif catch (Exception ex) { // We need to wrap all exceptions into an aggregate. diff --git a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/InlinedAggregationOperator.cs b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/InlinedAggregationOperator.cs index 09c14e9..f46df11 100644 --- a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/InlinedAggregationOperator.cs +++ b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/InlinedAggregationOperator.cs @@ -54,13 +54,6 @@ namespace System.Linq.Parallel { tr = InternalAggregate(ref toThrow); } -#if SUPPORT_THREAD_ABORT - catch (ThreadAbortException) - { - // Do not wrap ThreadAbortExceptions - throw; - } -#endif catch (Exception ex) { // If the exception is not an aggregate, we must wrap it up and throw that instead. diff --git a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Utils/ExceptionAggregator.cs b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Utils/ExceptionAggregator.cs index 292bcbd..a2103a4 100644 --- a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Utils/ExceptionAggregator.cs +++ b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Utils/ExceptionAggregator.cs @@ -40,13 +40,6 @@ namespace System.Linq.Parallel } elem = enumerator.Current; } -#if SUPPORT_THREAD_ABORT - catch (ThreadAbortException) - { - // Do not wrap ThreadAbortExceptions - throw; - } -#endif catch (Exception ex) { ThrowOCEorAggregateException(ex, cancellationState); @@ -79,13 +72,6 @@ namespace System.Linq.Parallel yield break; } } -#if SUPPORT_THREAD_ABORT - catch (ThreadAbortException) - { - // Do not wrap ThreadAbortExceptions - throw; - } -#endif catch (Exception ex) { ThrowOCEorAggregateException(ex, cancellationState); @@ -140,13 +126,6 @@ namespace System.Linq.Parallel { retval = f(t); } -#if SUPPORT_THREAD_ABORT - catch (ThreadAbortException) - { - // Do not wrap ThreadAbortExceptions - throw; - } -#endif catch (Exception ex) { ThrowOCEorAggregateException(ex, cancellationState); diff --git a/src/libraries/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs b/src/libraries/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs index 1865bad..17a378e 100644 --- a/src/libraries/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs +++ b/src/libraries/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs @@ -1579,13 +1579,6 @@ namespace System.Linq { acc = func(acc, elem); } -#if SUPPORT_THREAD_ABORT - catch (ThreadAbortException) - { - // Do not wrap ThreadAbortExceptions - throw; - } -#endif catch (Exception e) { throw new AggregateException(e); @@ -1718,13 +1711,6 @@ namespace System.Linq { return resultSelector(acc); } -#if SUPPORT_THREAD_ABORT - catch (ThreadAbortException) - { - // Do not wrap ThreadAbortExceptions - throw; - } -#endif catch (Exception e) { throw new AggregateException(e); @@ -4375,13 +4361,6 @@ namespace System.Linq } if (e2.MoveNext()) return false; } -#if SUPPORT_THREAD_ABORT - catch (ThreadAbortException) - { - // Do not wrap ThreadAbortExceptions - throw; - } -#endif catch (Exception ex) { ExceptionAggregator.ThrowOCEorAggregateException(ex, settings.CancellationState); @@ -4409,13 +4388,6 @@ namespace System.Linq { e.Dispose(); } -#if SUPPORT_THREAD_ABORT - catch (ThreadAbortException) - { - // Do not wrap ThreadAbortExceptions - throw; - } -#endif catch (Exception ex) { ExceptionAggregator.ThrowOCEorAggregateException(ex, cancelState); @@ -4968,13 +4940,6 @@ namespace System.Linq key = keySelector(val); result.Add(key, val); } -#if SUPPORT_THREAD_ABORT - catch (ThreadAbortException) - { - // Do not wrap ThreadAbortExceptions - throw; - } -#endif catch (Exception ex) { throw new AggregateException(ex); @@ -5072,13 +5037,6 @@ namespace System.Linq { result.Add(keySelector(src), elementSelector(src)); } -#if SUPPORT_THREAD_ABORT - catch (ThreadAbortException) - { - // Do not wrap ThreadAbortExceptions - throw; - } -#endif catch (Exception ex) { throw new AggregateException(ex); -- 2.7.4