We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 877550f commit 044b8c3Copy full SHA for 044b8c3
1 file changed
opencensus/context/internal/context.cc
@@ -22,6 +22,12 @@
22
#include "opencensus/tags/tag_map.h"
23
#include "opencensus/trace/span.h"
24
25
+#if defined(_MSC_VER)
26
+#define TLS __declspec(thread)
27
+#else
28
+#define TLS __thread
29
+#endif
30
+
31
namespace opencensus {
32
namespace context {
33
@@ -48,7 +54,7 @@ std::string Context::DebugString() const {
48
54
49
55
// static
50
56
Context* Context::InternalMutableCurrent() {
51
- static __thread Context* thread_ctx = nullptr;
57
+ static TLS Context* thread_ctx = nullptr;
52
58
if (thread_ctx == nullptr) thread_ctx = new Context;
53
59
return thread_ctx;
60
}
0 commit comments