use modular initing system rather than calling Init() method.

This commit is contained in:
Youmu Liu
2025-11-11 18:22:28 +08:00
parent 678a846e54
commit 44bf78b937
65 changed files with 1328 additions and 1814 deletions
@@ -30,6 +30,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -39,22 +40,19 @@ namespace StgSharp.Threading
public class FrameworkSyncContext : SynchronizationContext
{
private static readonly FrameworkSyncContext _mainThreadContext = new FrameworkSyncContext();
private readonly BlockingCollection<SendOrPostCallback> _syncContexts = new BlockingCollection<SendOrPostCallback>(
);
private readonly BlockingCollection<SendOrPostCallback> _syncContexts = [];
private readonly Thread _mainThread = Thread.CurrentThread;
public FrameworkSyncContext()
{
_syncContexts = new BlockingCollection<SendOrPostCallback>();
_mainThread = Thread.CurrentThread;
}
public static FrameworkSyncContext MainThreadContext
{
get => _mainThreadContext;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
} = new FrameworkSyncContext();
public override void Post(SendOrPostCallback d, object state)
{