mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Clarify CancellationToken handling in comments
Updated comments to explain the rationale for not directly passing CancellationToken to methods and instead checking IsCancellationRequested within locks. This prevents unexpected OperationCanceledException. Changes made in EverythingAPI.cs (IsEverythingRunningAsync) and Main.cs (Win32 and UWP program preparation). No functional changes to the code.
This commit is contained in:
parent
bfaff5cca5
commit
d0a47c84b9
2 changed files with 3 additions and 3 deletions
|
|
@ -49,7 +49,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything
|
|||
public static async ValueTask<bool> IsEverythingRunningAsync(CancellationToken token = default)
|
||||
{
|
||||
// We do not directly pass token here, but we check IsCancellationRequested inside the lock
|
||||
// So that it will not raise OperationCanceledException, which is not expected by the caller.`
|
||||
// So that it will not raise OperationCanceledException, which is not expected by the caller.
|
||||
await _semaphore.WaitAsync();
|
||||
|
||||
try
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ namespace Flow.Launcher.Plugin.Program
|
|||
var resultList = await Task.Run(async () =>
|
||||
{
|
||||
// We do not directly pass token here, but we check IsCancellationRequested inside the lock
|
||||
// So that it will not raise OperationCanceledException, which is not expected by the caller.`
|
||||
// So that it will not raise OperationCanceledException, which is not expected by the caller.
|
||||
Context.API.LogDebug(ClassName, "Preparing win32 programs");
|
||||
List<Win32> win32s;
|
||||
await _win32sLock.WaitAsync();
|
||||
|
|
@ -100,7 +100,7 @@ namespace Flow.Launcher.Plugin.Program
|
|||
}
|
||||
|
||||
// We do not directly pass token here, but we check IsCancellationRequested inside the lock
|
||||
// So that it will not raise OperationCanceledException, which is not expected by the caller.`
|
||||
// So that it will not raise OperationCanceledException, which is not expected by the caller.
|
||||
Context.API.LogDebug(ClassName, "Preparing UWP programs");
|
||||
List<UWPApp> uwps;
|
||||
await _uwpsLock.WaitAsync();
|
||||
|
|
|
|||
Loading…
Reference in a new issue