Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MODERN_THREAD_LOCAL macro #573

Merged
merged 1 commit into from
Oct 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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