Skip to content

Commit 1f0de43

Browse files
committed
Remove dead Net4.0 code
1 parent ae5447b commit 1f0de43

31 files changed

Lines changed: 33 additions & 393 deletions

src/Polly.Shared/Bulkhead/BulkheadEngine.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
using System;
22
using System.Threading;
33

4-
#if NET40
5-
using SemaphoreSlim = Nito.AsyncEx.AsyncSemaphore;
6-
using Polly.Utilities;
7-
#else
8-
using SemaphoreSlim = System.Threading.SemaphoreSlim;
9-
#endif
10-
114
namespace Polly.Bulkhead
125
{
136
internal static partial class BulkheadEngine

src/Polly.Shared/Bulkhead/BulkheadEngineAsync.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22
using System.Threading;
33
using System.Threading.Tasks;
44

5-
#if NET40
6-
using SemaphoreSlim = Nito.AsyncEx.AsyncSemaphore;
7-
using Polly.Utilities;
8-
#else
9-
using SemaphoreSlim = System.Threading.SemaphoreSlim;
10-
#endif
11-
125
namespace Polly.Bulkhead
136
{
147
internal static partial class BulkheadEngine

src/Polly.Shared/Bulkhead/BulkheadPolicy.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
using System.Threading;
33
using Polly.Utilities;
44

5-
#if NET40
6-
using SemaphoreSlim = Nito.AsyncEx.AsyncSemaphore;
7-
#else
8-
using SemaphoreSlim = System.Threading.SemaphoreSlim;
9-
#endif
10-
115
namespace Polly.Bulkhead
126
{
137
/// <summary>

src/Polly.Shared/Bulkhead/BulkheadPolicyAsync.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
using System.Threading.Tasks;
44
using Polly.Utilities;
55

6-
#if NET40
7-
using SemaphoreSlim = Nito.AsyncEx.AsyncSemaphore;
8-
#else
9-
using SemaphoreSlim = System.Threading.SemaphoreSlim;
10-
#endif
11-
126
namespace Polly.Bulkhead
137
{
148
public partial class BulkheadPolicy : IBulkheadPolicy

src/Polly.Shared/Bulkhead/BulkheadSyntax.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
using System;
44
using System.Threading;
55

6-
#if NET40
7-
using SemaphoreSlim = Nito.AsyncEx.AsyncSemaphore;
8-
#else
9-
using SemaphoreSlim = System.Threading.SemaphoreSlim;
10-
#endif
11-
126
namespace Polly
137
{
148
public partial class Policy
@@ -72,12 +66,12 @@ public static BulkheadPolicy Bulkhead(int maxParallelization, int maxQueuingActi
7266
if (maxQueuingActions < 0) throw new ArgumentOutOfRangeException(nameof(maxQueuingActions), "Value must be greater than or equal to zero.");
7367
if (onBulkheadRejected == null) throw new ArgumentNullException(nameof(onBulkheadRejected));
7468

75-
SemaphoreSlim maxParallelizationSemaphore = SemaphoreSlimFactory.CreateSemaphoreSlim(maxParallelization);
69+
SemaphoreSlim maxParallelizationSemaphore = new SemaphoreSlim(maxParallelization, maxParallelization);
7670

7771
var maxQueuingCompounded = maxQueuingActions <= int.MaxValue - maxParallelization
7872
? maxQueuingActions + maxParallelization
7973
: int.MaxValue;
80-
SemaphoreSlim maxQueuedActionsSemaphore = SemaphoreSlimFactory.CreateSemaphoreSlim(maxQueuingCompounded);
74+
SemaphoreSlim maxQueuedActionsSemaphore = new SemaphoreSlim(maxQueuingCompounded, maxQueuingCompounded);
8175

8276
return new BulkheadPolicy(
8377
(action, context, cancellationToken) => BulkheadEngine.Implementation(

src/Polly.Shared/Bulkhead/BulkheadSyntaxAsync.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
using System.Threading;
55
using System.Threading.Tasks;
66

7-
#if NET40
8-
using SemaphoreSlim = Nito.AsyncEx.AsyncSemaphore;
9-
#else
10-
using SemaphoreSlim = System.Threading.SemaphoreSlim;
11-
#endif
12-
137
namespace Polly
148
{
159
public partial class Policy
@@ -73,12 +67,12 @@ public static BulkheadPolicy BulkheadAsync(int maxParallelization, int maxQueuin
7367
if (maxQueuingActions < 0) throw new ArgumentOutOfRangeException(nameof(maxQueuingActions), "Value must be greater than or equal to zero.");
7468
if (onBulkheadRejectedAsync == null) throw new ArgumentNullException(nameof(onBulkheadRejectedAsync));
7569

76-
SemaphoreSlim maxParallelizationSemaphore = SemaphoreSlimFactory.CreateSemaphoreSlim(maxParallelization);
70+
SemaphoreSlim maxParallelizationSemaphore = new SemaphoreSlim(maxParallelization, maxParallelization);
7771

7872
var maxQueuingCompounded = maxQueuingActions <= int.MaxValue - maxParallelization
7973
? maxQueuingActions + maxParallelization
8074
: int.MaxValue;
81-
SemaphoreSlim maxQueuedActionsSemaphore = SemaphoreSlimFactory.CreateSemaphoreSlim(maxQueuingCompounded);
75+
SemaphoreSlim maxQueuedActionsSemaphore = new SemaphoreSlim(maxQueuingCompounded, maxQueuingCompounded);
8276

8377
return new BulkheadPolicy((action, context, cancellationToken, continueOnCapturedContext) =>
8478
BulkheadEngine.ImplementationAsync(

src/Polly.Shared/Bulkhead/BulkheadTResultSyntax.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
using Polly.Bulkhead;
2-
using Polly.Utilities;
32
using System;
43
using System.Threading;
5-
using System.Threading.Tasks;
6-
7-
#if NET40
8-
using SemaphoreSlim = Nito.AsyncEx.AsyncSemaphore;
9-
#else
10-
using SemaphoreSlim = System.Threading.SemaphoreSlim;
11-
#endif
124

135
namespace Polly
146
{
@@ -73,12 +65,12 @@ public static BulkheadPolicy<TResult> Bulkhead<TResult>(int maxParallelization,
7365
if (maxQueuingActions < 0) throw new ArgumentOutOfRangeException(nameof(maxQueuingActions), "Value must be greater than or equal to zero.");
7466
if (onBulkheadRejected == null) throw new ArgumentNullException(nameof(onBulkheadRejected));
7567

76-
SemaphoreSlim maxParallelizationSemaphore = SemaphoreSlimFactory.CreateSemaphoreSlim(maxParallelization);
68+
SemaphoreSlim maxParallelizationSemaphore = new SemaphoreSlim(maxParallelization, maxParallelization);
7769

7870
var maxQueuingCompounded = maxQueuingActions <= int.MaxValue - maxParallelization
7971
? maxQueuingActions + maxParallelization
8072
: int.MaxValue;
81-
SemaphoreSlim maxQueuedActionsSemaphore = SemaphoreSlimFactory.CreateSemaphoreSlim(maxQueuingCompounded);
73+
SemaphoreSlim maxQueuedActionsSemaphore = new SemaphoreSlim(maxQueuingCompounded, maxQueuingCompounded);
8274

8375
return new BulkheadPolicy<TResult>(
8476
(action, context, cancellationToken) => BulkheadEngine.Implementation(

src/Polly.Shared/Bulkhead/BulkheadTResultSyntaxAsync.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
using System.Threading;
55
using System.Threading.Tasks;
66

7-
#if NET40
8-
using SemaphoreSlim = Nito.AsyncEx.AsyncSemaphore;
9-
#else
10-
using SemaphoreSlim = System.Threading.SemaphoreSlim;
11-
#endif
12-
137
namespace Polly
148
{
159
public partial class Policy
@@ -73,12 +67,12 @@ public static BulkheadPolicy<TResult> BulkheadAsync<TResult>(int maxParallelizat
7367
if (maxQueuingActions < 0) throw new ArgumentOutOfRangeException(nameof(maxQueuingActions), "Value must be greater than or equal to zero.");
7468
if (onBulkheadRejectedAsync == null) throw new ArgumentNullException(nameof(onBulkheadRejectedAsync));
7569

76-
SemaphoreSlim maxParallelizationSemaphore = SemaphoreSlimFactory.CreateSemaphoreSlim(maxParallelization);
70+
SemaphoreSlim maxParallelizationSemaphore = new SemaphoreSlim(maxParallelization, maxParallelization);
7771

7872
var maxQueuingCompounded = maxQueuingActions <= int.MaxValue - maxParallelization
7973
? maxQueuingActions + maxParallelization
8074
: int.MaxValue;
81-
SemaphoreSlim maxQueuedActionsSemaphore = SemaphoreSlimFactory.CreateSemaphoreSlim(maxQueuingCompounded);
75+
SemaphoreSlim maxQueuedActionsSemaphore = new SemaphoreSlim(maxQueuingCompounded, maxQueuingCompounded);
8276

8377
return new BulkheadPolicy<TResult>(
8478
(action, context, cancellationToken, continueOnCapturedContext) => BulkheadEngine.ImplementationAsync(

src/Polly.Shared/CircuitBreaker/CircuitBreakerEngine.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
using System.Runtime.ExceptionServices;
55
using System.Threading;
66

7-
#if NET40
8-
using ExceptionDispatchInfo = Polly.Utilities.ExceptionDispatchInfo;
9-
#endif
10-
117
namespace Polly.CircuitBreaker
128
{
139
internal partial class CircuitBreakerEngine

src/Polly.Shared/CircuitBreaker/CircuitBreakerEngineAsync.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
using System.Threading;
66
using System.Threading.Tasks;
77

8-
#if NET40
9-
using ExceptionDispatchInfo = Polly.Utilities.ExceptionDispatchInfo;
10-
#endif
11-
128
namespace Polly.CircuitBreaker
139
{
1410
internal partial class CircuitBreakerEngine

0 commit comments

Comments
 (0)