Initial commit: AetherBags + KamiToolKit for FC Gitea
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using Dalamud.Utility;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Framework;
|
||||
using KamiToolKit.Classes;
|
||||
|
||||
namespace KamiToolKit.Extensions;
|
||||
|
||||
public static unsafe class MainThreadSafety {
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if <em>not</em> on the main thread. Use this to return early.
|
||||
/// </summary>
|
||||
public static bool TryAssertMainThread([CallerFilePath] string? callerFilePath = null, [CallerMemberName] string? callerName = null) {
|
||||
if (Framework.Instance()->IsDestroying) return true;
|
||||
|
||||
if (!ThreadSafety.IsMainThread) {
|
||||
Log.Error($"{callerFilePath?.Split(@"\")[^1][..^2]}{callerName} must be invoked from the main thread.");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user