From 07efe11d68367d52b1e8336557c59bf64653b5bf Mon Sep 17 00:00:00 2001 From: Anirudh Subramanian Date: Fri, 18 Oct 2019 02:55:49 +0000 Subject: [PATCH] Add MODERN_THREAD_LOCAL check --- include/dmlc/base.h | 6 ++++++ include/dmlc/thread_local.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/dmlc/base.h b/include/dmlc/base.h index 3e76385715..29f4a1e1a4 100644 --- a/include/dmlc/base.h +++ b/include/dmlc/base.h @@ -92,6 +92,12 @@ #endif #endif +/*! \brief Whether to use modern thread local construct */ +#ifndef DMLC_MODERN_THREAD_LOCAL +#define DMLC_MODERN_THREAD_LOCAL 1 +#endif + + /*! \brief whether RTTI is enabled */ #ifndef DMLC_ENABLE_RTTI diff --git a/include/dmlc/thread_local.h b/include/dmlc/thread_local.h index fecaef8686..b10939c20e 100644 --- a/include/dmlc/thread_local.h +++ b/include/dmlc/thread_local.h @@ -36,7 +36,7 @@ class ThreadLocalStore { public: /*! \return get a thread local singleton */ static T* Get() { -#if DMLC_CXX11_THREAD_LOCAL +#if DMLC_CXX11_THREAD_LOCAL && DMLC_MODERN_THREAD_LOCAL == 1 static thread_local T inst; return &inst; #else