Prechádzať zdrojové kódy

thread local refactoring

Mircea TheHonestCTO 3 mesiacov pred
rodič
commit
1e2ed620f7

+ 3 - 0
AI/Nullkiller2/AIGateway.cpp

@@ -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()

+ 2 - 3
AI/Nullkiller2/AIGateway.h

@@ -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