[Bf-blender-cvs] [b9ee2fb77cc] greasepencil-object: MSVC 2013 Compile Fix/Workaround for "static thread_local" vars

Joshua Leung noreply at git.blender.org
Thu Feb 22 07:23:00 CET 2018


Commit: b9ee2fb77ccd85d796d173ac0b0d200846573eed
Author: Joshua Leung
Date:   Thu Feb 22 19:22:50 2018 +1300
Branches: greasepencil-object
https://developer.blender.org/rBb9ee2fb77ccd85d796d173ac0b0d200846573eed

MSVC 2013 Compile Fix/Workaround for "static thread_local" vars

Apparently MSVC 2013 has trouble with stuff that's been declared
"static thread_local" (and/or maybe even the "thread_local" keyword).

https://stackoverflow.com/questions/29399494/what-is-the-current-state-of-support-for-thread-local-across-platforms

===================================================================

M	intern/gawain/src/gwn_vertex_array_id.cpp

===================================================================

diff --git a/intern/gawain/src/gwn_vertex_array_id.cpp b/intern/gawain/src/gwn_vertex_array_id.cpp
index 1e833f7b2d0..f9ea95b73c5 100644
--- a/intern/gawain/src/gwn_vertex_array_id.cpp
+++ b/intern/gawain/src/gwn_vertex_array_id.cpp
@@ -38,7 +38,12 @@ struct Gwn_Context {
 #endif
 };
 
+#if defined(_MSC_VER) && (_MSC_VER == 1800)
+#define thread_local __declspec(thread)
+thread_local Gwn_Context* active_ctx = NULL;
+#else
 static thread_local Gwn_Context* active_ctx = NULL;
+#endif
 
 static void clear_orphans(Gwn_Context* ctx)
 	{



More information about the Bf-blender-cvs mailing list