mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 21:24:16 +01:00
Load services asynchronously whenever possible (#893)
This commit is contained in:
parent
fba8c7163c
commit
8e7f370ddd
66 changed files with 959 additions and 899 deletions
|
|
@ -12,6 +12,7 @@ namespace Dalamud.Logging.Internal
|
|||
/// <summary>
|
||||
/// Class responsible for tracking asynchronous tasks.
|
||||
/// </summary>
|
||||
[ServiceManager.EarlyLoadedService]
|
||||
internal class TaskTracker : IDisposable
|
||||
{
|
||||
private static readonly ModuleLog Log = new("TT");
|
||||
|
|
@ -20,16 +21,14 @@ namespace Dalamud.Logging.Internal
|
|||
private static bool clearRequested = false;
|
||||
|
||||
private MonoMod.RuntimeDetour.Hook? scheduleAndStartHook;
|
||||
private bool enabled = false;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TaskTracker"/> class.
|
||||
/// </summary>
|
||||
public TaskTracker()
|
||||
[ServiceManager.ServiceConstructor]
|
||||
private TaskTracker()
|
||||
{
|
||||
this.ApplyPatch();
|
||||
|
||||
var framework = Service<Framework>.Get();
|
||||
framework.Update += this.FrameworkOnUpdate;
|
||||
#if DEBUG
|
||||
this.Enable();
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -102,6 +101,21 @@ namespace Dalamud.Logging.Internal
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables TaskTracker.
|
||||
/// </summary>
|
||||
public void Enable()
|
||||
{
|
||||
if (this.enabled)
|
||||
return;
|
||||
|
||||
this.ApplyPatch();
|
||||
|
||||
var framework = Service<Framework>.Get();
|
||||
framework.Update += this.FrameworkOnUpdate;
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue