1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

thread local refactoring

This commit is contained in:
Mircea TheHonestCTO
2025-08-30 07:27:07 +02:00
parent deeb995d77
commit 1e2ed620f7
2 changed files with 5 additions and 3 deletions

View File

@@ -39,6 +39,9 @@
namespace NK2AI
{
// one thread may be turn of AI and another will be handling a side effect for AI2
thread_local CCallback * ccTl = nullptr;
thread_local AIGateway * aiGwTl = nullptr;
#define NET_EVENT_HANDLER SET_GLOBAL_STATE(this)
AIGateway::AIGateway()

View File

@@ -28,9 +28,8 @@ VCMI_LIB_NAMESPACE_END
namespace NK2AI
{
// one thread may be turn of AI and another will be handling a side effect for AI2
inline thread_local CCallback * ccTl = nullptr;
inline thread_local AIGateway * aiGwTl = nullptr;
extern thread_local CCallback * ccTl;
extern thread_local AIGateway * aiGwTl;
// helper RAII to manage global ai/cb ptrs
struct SetGlobalState