mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
fix concurrency issue (potentially)
This commit is contained in:
parent
605db6095a
commit
4a0ee9b4fc
1 changed files with 7 additions and 8 deletions
|
|
@ -19,9 +19,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything
|
|||
|
||||
private const int BufferSize = 4096;
|
||||
|
||||
private static SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1);
|
||||
private static SemaphoreSlim _semaphore = new(1, 1);
|
||||
// cached buffer to remove redundant allocations.
|
||||
private static readonly StringBuilder buffer = new StringBuilder(BufferSize);
|
||||
private static readonly StringBuilder buffer = new(BufferSize);
|
||||
|
||||
public enum StateCode
|
||||
{
|
||||
|
|
@ -118,14 +118,13 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything
|
|||
|
||||
if (option.MaxCount < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(option.MaxCount), option.MaxCount, "MaxCount must be greater than or equal to 0");
|
||||
|
||||
await _semaphore.WaitAsync(token);
|
||||
|
||||
if (token.IsCancellationRequested)
|
||||
yield break;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
await _semaphore.WaitAsync(token);
|
||||
|
||||
if (token.IsCancellationRequested)
|
||||
yield break;
|
||||
|
||||
if (option.Keyword.StartsWith("@"))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue