diff --git a/SystemExtensions.NetCore/SystemExtensions.NetCore.csproj b/SystemExtensions.NetCore/SystemExtensions.NetCore.csproj
index 6a2a13c..07f9d74 100644
--- a/SystemExtensions.NetCore/SystemExtensions.NetCore.csproj
+++ b/SystemExtensions.NetCore/SystemExtensions.NetCore.csproj
@@ -8,7 +8,7 @@
System
LICENSE
true
- 1.6.11
+ 1.6.12
Alexandru Macocian
https://github.com/AlexMacocian/SystemExtensions
Extensions for the System namespace
diff --git a/SystemExtensions.NetStandard/Extensions/SemaphoreSlimExtensions.cs b/SystemExtensions.NetStandard/Extensions/SemaphoreSlimExtensions.cs
index 0e6509f..cccd994 100644
--- a/SystemExtensions.NetStandard/Extensions/SemaphoreSlimExtensions.cs
+++ b/SystemExtensions.NetStandard/Extensions/SemaphoreSlimExtensions.cs
@@ -8,4 +8,9 @@ public static class SemaphoreSlimExtensions
{
return await SemaphoreSlimContext.Create(semaphore);
}
+
+ public static async Task Acquire(this SemaphoreSlim semaphore, CancellationToken cancellationToken)
+ {
+ return await SemaphoreSlimContext.Create(semaphore, cancellationToken);
+ }
}
diff --git a/SystemExtensions.NetStandard/SystemExtensions.NetStandard.csproj b/SystemExtensions.NetStandard/SystemExtensions.NetStandard.csproj
index 4a5122c..575c8a0 100644
--- a/SystemExtensions.NetStandard/SystemExtensions.NetStandard.csproj
+++ b/SystemExtensions.NetStandard/SystemExtensions.NetStandard.csproj
@@ -2,12 +2,12 @@
netstandard2.0
- latest
+ latest
true
LICENSE
true
System
- 1.6.11
+ 1.6.12
Alexandru Macocian
https://github.com/AlexMacocian/SystemExtensions
Extensions for the System namespace
diff --git a/SystemExtensions.NetStandard/Threading/SemaphoreSlimContext.cs b/SystemExtensions.NetStandard/Threading/SemaphoreSlimContext.cs
index fca40d7..3d4dcaf 100644
--- a/SystemExtensions.NetStandard/Threading/SemaphoreSlimContext.cs
+++ b/SystemExtensions.NetStandard/Threading/SemaphoreSlimContext.cs
@@ -21,4 +21,10 @@ public readonly struct SemaphoreSlimContext : IDisposable
await semaphore.ThrowIfNull(nameof(semaphore)).WaitAsync();
return new SemaphoreSlimContext(semaphore);
}
+
+ public static async Task Create(SemaphoreSlim semaphore, CancellationToken cancellationToken)
+ {
+ await semaphore.ThrowIfNull(nameof(semaphore)).WaitAsync(cancellationToken);
+ return new SemaphoreSlimContext(semaphore);
+ }
}