diff options
author | Andres Noetzli <andres.noetzli@gmail.com> | 2017-08-30 20:55:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-30 20:55:27 -0700 |
commit | 546d795470ca7c30fc62fe9b6c7b8e5838e1eed4 (patch) | |
tree | 443f7101c4246b684ce21a04704d769eb2db15ad /src/options/options_template.cpp | |
parent | d7dadde871ae4775748695b0b7f9deee49576c0a (diff) |
Use thread_local instead of compiler extensions (#210)
C++11 introduced the thread_local keyword, so we don't need to use
non-standard extensions or our custom pthread extension anymore.
The behavior was previously introduced as a workaround in commit
753a072c542c1c254d7c6adbf10e091ba585ede5. This commit
introduces the macro CVC4_THREAD_LOCAL that can be used to
declare variables as thread local. For Swig, this macro is defined to
be empty.
Diffstat (limited to 'src/options/options_template.cpp')
-rw-r--r-- | src/options/options_template.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/options/options_template.cpp b/src/options/options_template.cpp index bc97e6028..a48b22625 100644 --- a/src/options/options_template.cpp +++ b/src/options/options_template.cpp @@ -48,10 +48,10 @@ extern int optreset; #include <sstream> #include <limits> +#include "base/tls.h" #include "base/cvc4_assert.h" #include "base/exception.h" #include "base/output.h" -#include "base/tls.h" #include "options/argument_extender.h" #include "options/argument_extender_implementation.h" #include "options/didyoumean.h" @@ -75,7 +75,7 @@ using namespace CVC4::options; namespace CVC4 { -CVC4_THREADLOCAL(Options*) Options::s_current = NULL; +CVC4_THREAD_LOCAL Options* Options::s_current = NULL; @@ -532,10 +532,10 @@ namespace options { /** Set a given Options* as "current" just for a particular scope. */ class OptionsGuard { - CVC4_THREADLOCAL_TYPE(Options*)* d_field; + Options** d_field; Options* d_old; public: - OptionsGuard(CVC4_THREADLOCAL_TYPE(Options*)* field, Options* opts) : + OptionsGuard(Options** field, Options* opts) : d_field(field), d_old(*field) { *field = opts; |