Make all TCS RunContinuationsAsynchronously

This commit is contained in:
Soreepeong 2024-07-21 20:49:41 +09:00
parent 856c198934
commit 1be5cd452d
14 changed files with 33 additions and 23 deletions

View file

@ -315,7 +315,7 @@ internal class PluginImageCache : IInternalDisposableService
private Task<T> RunInDownloadQueue<T>(Func<Task<T>> func, ulong requestedFrame)
{
var tcs = new TaskCompletionSource<T>();
var tcs = new TaskCompletionSource<T>(TaskCreationOptions.RunContinuationsAsynchronously);
this.downloadQueue.Add(Tuple.Create(requestedFrame, async () =>
{
try
@ -332,7 +332,7 @@ internal class PluginImageCache : IInternalDisposableService
private Task<T> RunInLoadQueue<T>(Func<Task<T>> func)
{
var tcs = new TaskCompletionSource<T>();
var tcs = new TaskCompletionSource<T>(TaskCreationOptions.RunContinuationsAsynchronously);
this.loadQueue.Add(async () =>
{
try

View file

@ -3774,7 +3774,7 @@ internal class PluginInstallerWindow : Window, IDisposable
this.errorModalMessage = message;
this.errorModalDrawing = true;
this.errorModalOnNextFrame = true;
this.errorModalTaskCompletionSource = new TaskCompletionSource();
this.errorModalTaskCompletionSource = new(TaskCreationOptions.RunContinuationsAsynchronously);
return this.errorModalTaskCompletionSource.Task;
}
@ -3782,7 +3782,7 @@ internal class PluginInstallerWindow : Window, IDisposable
{
this.updateModalOnNextFrame = true;
this.updateModalPlugin = plugin;
this.updateModalTaskCompletionSource = new TaskCompletionSource<bool>();
this.updateModalTaskCompletionSource = new(TaskCreationOptions.RunContinuationsAsynchronously);
return this.updateModalTaskCompletionSource.Task;
}