Skip to content

Commit

Permalink
Add MODERN_THREAD_LOCAL check (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudh2290 authored and tqchen committed Oct 18, 2019
1 parent 20676bb commit 0e13243
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions include/dmlc/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/dmlc/thread_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0e13243

Please sign in to comment.