Merge remote-tracking branch 'origin/master' into net8-rollup

This commit is contained in:
github-actions[bot] 2024-03-08 22:05:05 +00:00
commit 11c1759b60
17 changed files with 1345 additions and 868 deletions

View file

@ -1,4 +1,5 @@
using System;
using System.Runtime.CompilerServices;
namespace Dalamud.Utility;
@ -19,6 +20,7 @@ public static class ThreadSafety
/// Throws an exception when the current thread is not the main thread.
/// </summary>
/// <exception cref="InvalidOperationException">Thrown when the current thread is not the main thread.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void AssertMainThread()
{
if (!threadStaticIsMainThread)
@ -31,6 +33,7 @@ public static class ThreadSafety
/// Throws an exception when the current thread is the main thread.
/// </summary>
/// <exception cref="InvalidOperationException">Thrown when the current thread is the main thread.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void AssertNotMainThread()
{
if (threadStaticIsMainThread)
@ -39,6 +42,15 @@ public static class ThreadSafety
}
}
/// <summary><see cref="AssertMainThread"/>, but only on debug compilation mode.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void DebugAssertMainThread()
{
#if DEBUG
AssertMainThread();
#endif
}
/// <summary>
/// Marks a thread as the main thread.
/// </summary>