3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 11:55:51 +00:00

restore most global muxes as heap-allocated to avoid crashes with hard-kills like ctrl-c

This commit is contained in:
Nuno Lopes 2019-06-13 18:42:57 +01:00
parent d17248821a
commit c21f0c2f00
8 changed files with 55 additions and 49 deletions

View file

@ -40,11 +40,11 @@ static void mk_power_up_to(vector<rational> & pws, unsigned n) {
}
}
static mutex g_powers_of_two;
static DECLARE_MUTEX(g_powers_of_two);
rational rational::power_of_two(unsigned k) {
rational result;
lock_guard lock(g_powers_of_two);
lock_guard lock(*g_powers_of_two);
{
if (k >= m_powers_of_two.size())
mk_power_up_to(m_powers_of_two, k+1);
@ -81,5 +81,6 @@ void rational::finalize() {
m_minus_one.~rational();
dealloc(g_mpq_manager);
g_mpq_manager = nullptr;
delete g_powers_of_two;
}