Dalamud/Dalamud/Utility/ScopedSyncRoot.cs
goat 448b0d16ea
Add "loading dialog" for service init, unify blocking logic (#1779)
* wip

* hacky fix for overlapping event text in profiler

* move IsResumeGameAfterPluginLoad logic to PluginManager

* fix some warnings

* handle exceptions properly

* remove ability to cancel, rename button to "hide" instead

* undo Dalamud.Service refactor for now

* warnings

* add explainer, show which plugins are still loading

* add some text if loading takes more than 3 minutes

* undo wrong CS merge
2024-04-21 17:28:37 +02:00

28 lines
625 B
C#

using System.Threading;
namespace Dalamud.Utility;
/// <summary>
/// Scope for plugin list locks.
/// </summary>
public class ScopedSyncRoot : IDisposable
{
private readonly object lockObj;
/// <summary>
/// Initializes a new instance of the <see cref="ScopedSyncRoot"/> class.
/// </summary>
/// <param name="lockObj">The object to lock.</param>
public ScopedSyncRoot(object lockObj)
{
this.lockObj = lockObj;
Monitor.Enter(lockObj);
}
/// <inheritdoc/>
public void Dispose()
{
GC.SuppressFinalize(this);
Monitor.Exit(this.lockObj);
}
}