mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
ensure smt2log works with multi-threaded consumers, ease scenarios around #5655
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
5194aa186a
commit
ca2c2bb802
|
@ -158,10 +158,19 @@ extern "C" {
|
|||
init_solver_core(c, s);
|
||||
}
|
||||
|
||||
static std::thread::id g_thread_id = std::this_thread::get_id();
|
||||
static bool g_is_threaded = false;
|
||||
|
||||
static void init_solver_log(Z3_context c, Z3_solver s) {
|
||||
solver_params sp(to_solver(s)->m_params);
|
||||
symbol smt2log = sp.smtlib2_log();
|
||||
if (smt2log.is_non_empty_string() && !to_solver(s)->m_pp) {
|
||||
if (g_is_threaded || g_thread_id != std::this_thread::get_id()) {
|
||||
g_is_threaded = true;
|
||||
std::ostringstream strm;
|
||||
strm << smt2log << "-" << std::this_thread::get_id();
|
||||
smt2log = symbol(strm.str());
|
||||
}
|
||||
to_solver(s)->m_pp = alloc(solver2smt2_pp, mk_c(c)->m(), smt2log.str());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue