ioc: actually make early blocking services blocking again

This commit is contained in:
goat 2024-04-18 22:26:44 +02:00
parent ddc7667ab5
commit 1d75c8edda

View file

@ -68,10 +68,16 @@ internal sealed class Dalamud : IServiceType
// Set up FFXIVClientStructs // Set up FFXIVClientStructs
this.SetupClientStructsResolver(cacheDir); this.SetupClientStructsResolver(cacheDir);
void KickoffGameThread()
{
Log.Verbose("=============== GAME THREAD KICKOFF ===============");
Timings.Event("Game thread kickoff");
NativeFunctions.SetEvent(mainThreadContinueEvent);
}
if (!configuration.IsResumeGameAfterPluginLoad) if (!configuration.IsResumeGameAfterPluginLoad)
{ {
NativeFunctions.SetEvent(mainThreadContinueEvent);
ServiceManager.InitializeEarlyLoadableServices() ServiceManager.InitializeEarlyLoadableServices()
.ContinueWith(t => .ContinueWith(t =>
{ {
@ -83,6 +89,8 @@ internal sealed class Dalamud : IServiceType
"Dalamud failed to load all necessary services.\n\nThe game will continue, but you may not be able to use plugins.", "Dalamud failed to load all necessary services.\n\nThe game will continue, but you may not be able to use plugins.",
"Dalamud", false); "Dalamud", false);
}); });
ServiceManager.BlockingResolved.ContinueWith(_ => KickoffGameThread());
} }
else else
{ {
@ -101,7 +109,7 @@ internal sealed class Dalamud : IServiceType
if (faultedTasks.Any()) if (faultedTasks.Any())
throw new AggregateException(faultedTasks); throw new AggregateException(faultedTasks);
NativeFunctions.SetEvent(mainThreadContinueEvent); KickoffGameThread();
await Task.WhenAll(tasks); await Task.WhenAll(tasks);
} }
@ -112,7 +120,7 @@ internal sealed class Dalamud : IServiceType
} }
finally finally
{ {
NativeFunctions.SetEvent(mainThreadContinueEvent); KickoffGameThread();
} }
}); });
} }