mirror of
https://github.com/Z3Prover/z3
synced 2025-06-19 12:23:38 +00:00
add initialization
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
583098b8b0
commit
71c38a08e5
13 changed files with 92 additions and 43 deletions
|
@ -23,7 +23,7 @@ Revision History:
|
|||
#include "util/string_buffer.h"
|
||||
#include <cstring>
|
||||
|
||||
static mutex g_symbol_lock;
|
||||
static mutex* s_mux = nullptr;
|
||||
|
||||
symbol symbol::m_dummy(TAG(void*, nullptr, 2));
|
||||
const symbol symbol::null;
|
||||
|
@ -38,7 +38,7 @@ public:
|
|||
|
||||
char const * get_str(char const * d) {
|
||||
const char * result;
|
||||
lock_guard lock(g_symbol_lock);
|
||||
lock_guard lock(*s_mux);
|
||||
str_hashtable::entry * e;
|
||||
if (m_table.insert_if_not_there_core(d, e)) {
|
||||
// new entry
|
||||
|
@ -66,11 +66,16 @@ void initialize_symbols() {
|
|||
if (!g_symbol_table) {
|
||||
g_symbol_table = alloc(internal_symbol_table);
|
||||
}
|
||||
if (!s_mux) {
|
||||
s_mux = alloc(mutex);
|
||||
}
|
||||
}
|
||||
|
||||
void finalize_symbols() {
|
||||
dealloc(g_symbol_table);
|
||||
dealloc(s_mux);
|
||||
g_symbol_table = nullptr;
|
||||
s_mux = nullptr;
|
||||
}
|
||||
|
||||
symbol::symbol(char const * d) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue