mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-30 16:39:21 +01:00
Prevent disposed semaphore exceptions by checking the cancellation token first
This commit is contained in:
@@ -19,8 +19,8 @@ namespace Tgstation.Server.Host.Core
|
||||
{
|
||||
if (semaphore == null)
|
||||
throw new ArgumentNullException(nameof(semaphore));
|
||||
await semaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
await semaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||
return new SemaphoreSlimContext(semaphore);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user