mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-18 05:47:43 +01:00
SeStringEvaluator: Throw if not on main thread
This commit is contained in:
parent
84f5dad0a3
commit
f209ac087a
2 changed files with 4 additions and 7 deletions
|
|
@ -18,13 +18,14 @@ public static class ThreadSafety
|
|||
/// <summary>
|
||||
/// Throws an exception when the current thread is not the main thread.
|
||||
/// </summary>
|
||||
/// <param name="message">The message to be passed into the exception, if one is to be thrown.</param>
|
||||
/// <exception cref="InvalidOperationException">Thrown when the current thread is not the main thread.</exception>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void AssertMainThread()
|
||||
public static void AssertMainThread(string? message = null)
|
||||
{
|
||||
if (!threadStaticIsMainThread)
|
||||
{
|
||||
throw new InvalidOperationException("Not on main thread!");
|
||||
throw new InvalidOperationException(message ?? "Not on main thread!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue