diff --git a/include/rocksdb/iostats_context.h b/include/rocksdb/iostats_context.h index 7be3afa591..d0dbfa5fc2 100644 --- a/include/rocksdb/iostats_context.h +++ b/include/rocksdb/iostats_context.h @@ -7,7 +7,6 @@ #include #include -#include "port/port.h" #include "rocksdb/perf_level.h" // A thread local context for gathering io-stats efficiently and transparently. @@ -48,7 +47,12 @@ struct IOStatsContext { }; #ifdef ROCKSDB_SUPPORT_THREAD_LOCAL -extern __thread IOStatsContext iostats_context; + #if defined(_MSC_VER) && !defined(__thread) + // Thread local storage on Linux + // There is thread_local in C++11 + #define __thread __declspec(thread) + #endif + extern __thread IOStatsContext iostats_context; #endif } // namespace rocksdb diff --git a/include/rocksdb/perf_context.h b/include/rocksdb/perf_context.h index e3c86c39cb..785dfc7cda 100644 --- a/include/rocksdb/perf_context.h +++ b/include/rocksdb/perf_context.h @@ -9,7 +9,6 @@ #include #include -#include "port/port.h" #include "rocksdb/perf_level.h" namespace rocksdb { @@ -158,6 +157,11 @@ extern PerfContext perf_context; PerfContext *getPerfContext(); #define perf_context (*getPerfContext()) #else + #if defined(_MSC_VER) && !defined(__thread) + // Thread local storage on Linux + // There is thread_local in C++11 + #define __thread __declspec(thread) + #endif extern __thread PerfContext perf_context; #endif #endif