daily update on 20250122 by nitload youmu, architect rearrange

This commit is contained in:
Nitload
2025-01-22 11:34:49 +08:00
parent 6cfaa42ff3
commit 190d67a034
192 changed files with 25177 additions and 3156 deletions
@@ -41,16 +41,17 @@ namespace StgSharp.Threading
public static partial class ThreadHelper
{
private static readonly int mainThreadId = Thread.CurrentThread.ManagedThreadId;
private static readonly int mainThreadId = Environment.CurrentManagedThreadId;
private static readonly ThreadLocal<bool> isNotMainThread = new ThreadLocal<bool>(
() => Thread.CurrentThread.ManagedThreadId != mainThreadId );
() => Environment.CurrentManagedThreadId != mainThreadId );
[Conditional( "DEBUG" )]
internal static void MainThreadAssert()
{
if( isNotMainThread.Value ) {
throw new InvalidOperationException(
$"Attempt to call sensitive operation which can be only called from main thread " + $"from thread {Thread.CurrentThread.ManagedThreadId}." );
$"Attempt to call sensitive operation which can be only called from main thread "
+ $"from thread {Environment.CurrentManagedThreadId}." );
}
}