diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-10-05 09:12:04 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-10-05 09:12:04 -0500 |
| commit | 85d99db5f390af5df211101fa83ce256bb16ba95 (patch) | |
| tree | 75670f8559f14edd6d3a7dcb2946e433732796cf /src | |
| parent | b38d9f01862b4fc27874bf99d4b24b53a6577bd0 (diff) | |
| download | slskd-85d99db5f390af5df211101fa83ce256bb16ba95.tar.gz | |
run continuations async
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Common/TokenBucket.cs | 4 | ||||
| -rw-r--r-- | src/slskd/Transfers/Downloads/DownloadService.cs | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/slskd/Common/TokenBucket.cs b/src/slskd/Common/TokenBucket.cs index 11d64b88..440f25ae 100644 --- a/src/slskd/Common/TokenBucket.cs +++ b/src/slskd/Common/TokenBucket.cs @@ -92,7 +92,7 @@ namespace slskd /// </summary> public class TokenBucket : ITokenBucket, IDisposable { - private TaskCompletionSource<bool> waitForReset = new(); + private TaskCompletionSource<bool> waitForReset = new(TaskCreationOptions.RunContinuationsAsynchronously); /// <summary> /// Initializes a new instance of the <see cref="TokenBucket"/> class. @@ -243,6 +243,6 @@ namespace slskd } private void Reset() - => Interlocked.Exchange(ref waitForReset, new TaskCompletionSource<bool>()).SetResult(true); + => Interlocked.Exchange(ref waitForReset, new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously)).SetResult(true); } } diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs index 30f3c9b1..cb9423bc 100644 --- a/src/slskd/Transfers/Downloads/DownloadService.cs +++ b/src/slskd/Transfers/Downloads/DownloadService.cs @@ -509,7 +509,7 @@ namespace slskd.Transfers.Downloads add this to the dictionary before inserting the record, so we are guaranteed to have it in the right place once the transfer hits the UI */ - var enqueuedTcs = new TaskCompletionSource<Transfer>(); + var enqueuedTcs = new TaskCompletionSource<Transfer>(TaskCreationOptions.RunContinuationsAsynchronously); // satisfies condition #3; CancellationTokenSource set cancelled by the user (via API call) var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); |
