Change generated options to be thread_local. (#5583)
authorEverett Maus <ejm3y@virginia.edu>
Sat, 5 Dec 2020 01:09:54 +0000 (17:09 -0800)
committerGitHub <noreply@github.com>
Sat, 5 Dec 2020 01:09:54 +0000 (17:09 -0800)
Signed-off-by: Everett Maus <evmaus@google.com>
src/options/mkoptions.py

index 08f54f608eaade3f71d8382148b2c035fb52c1be..a12a0070b25c012199d51ca620b0ea6dd008474f 100644 (file)
@@ -175,7 +175,7 @@ TPL_OPTION_STRUCT_RW = \
   bool wasSetByUser() const;
   void set(const type& v);
   const char* getName() const;
-}} {name} CVC4_PUBLIC;"""
+}} thread_local {name} CVC4_PUBLIC;"""
 
 TPL_OPTION_STRUCT_RO = \
 """extern struct CVC4_PUBLIC {name}__option_t
@@ -184,7 +184,7 @@ TPL_OPTION_STRUCT_RO = \
   type operator()() const;
   bool wasSetByUser() const;
   const char* getName() const;
-}} {name} CVC4_PUBLIC;"""
+}} thread_local {name} CVC4_PUBLIC;"""
 
 
 TPL_DECL_SET = \
@@ -629,7 +629,7 @@ def codegen_module(module, dst_dir, tpl_module_h, tpl_module_cpp):
         accs.append(TPL_IMPL_WAS_SET_BY_USER.format(name=option.name))
 
         # Global definitions
-        defs.append('struct {name}__option_t {name};'.format(name=option.name))
+        defs.append('thread_local struct {name}__option_t {name};'.format(name=option.name))
 
         if option.mode:
             values = option.mode.keys()