Files
hjha-server/ServerCore/NetWork/ServiceThreadManager.cs
xiaoou e9616125ce feat: initial commit - HJHA game server full source
6 major server modules (PdkFriendServer/GlobalSever/ServerCore/GameModule/GameNetModule) +
game logic (GameFix/GameDAL/ServerData) +
network layer (NetWorkMessage) +
data layer (ObjectModel) +
utilities (MrWu/Core/Config/CloudAPI/dll) +
adapters (zyxAdapter/base)

.NET 8.0 C# solution, 16 projects, 958 source files
2026-07-07 12:02:15 +08:00

31 lines
1003 B
C#

using System.Collections.Concurrent;
using System.Diagnostics;
using Server.Core;
using Debug = MrWu.Debug.Debug;
namespace Server.Net
{
public class ServiceThreadManager : SingleInstance<ServiceThreadManager>
{
/// <summary>
/// 线程管理
/// </summary>
public ConcurrentDictionary<AService, int> Threads = new ConcurrentDictionary<AService, int>();
public void CheckThread(AService service,int threadId)
{
if (Threads.TryGetValue(service,out int _threadId))
{
if (_threadId != threadId)
{
StackTrace stackTrace = new StackTrace();
Debug.Error($"线程ID不一致:{_threadId} {threadId} {stackTrace.ToString()}");
}
}
else if (!Threads.TryAdd(service, threadId))
{
Debug.Error("未正常添加到线程管理!");
}
}
}
}