mirror of
https://github.com/Z3Prover/z3
synced 2025-08-04 10:20:23 +00:00
fix crash on Mac due to different destruction order of globals
the mutex in memory_manager has to be destroyed after all mem deallocations happen
This commit is contained in:
parent
2bee9a062f
commit
cf3e649462
12 changed files with 80 additions and 120 deletions
|
@ -21,16 +21,7 @@ Revision History:
|
|||
#include "util/mutex.h"
|
||||
|
||||
|
||||
static mutex* s_mux = nullptr;
|
||||
|
||||
void initialize_rlimit() {
|
||||
s_mux = new mutex;
|
||||
}
|
||||
void finalize_rlimit() {
|
||||
delete s_mux;
|
||||
s_mux = nullptr;
|
||||
}
|
||||
|
||||
static mutex g_rlimit_mux;
|
||||
|
||||
reslimit::reslimit():
|
||||
m_cancel(0),
|
||||
|
@ -82,32 +73,32 @@ char const* reslimit::get_cancel_msg() const {
|
|||
}
|
||||
|
||||
void reslimit::push_child(reslimit* r) {
|
||||
lock_guard lock(*s_mux);
|
||||
lock_guard lock(g_rlimit_mux);
|
||||
m_children.push_back(r);
|
||||
}
|
||||
|
||||
void reslimit::pop_child() {
|
||||
lock_guard lock(*s_mux);
|
||||
lock_guard lock(g_rlimit_mux);
|
||||
m_children.pop_back();
|
||||
}
|
||||
|
||||
void reslimit::cancel() {
|
||||
lock_guard lock(*s_mux);
|
||||
lock_guard lock(g_rlimit_mux);
|
||||
set_cancel(m_cancel+1);
|
||||
}
|
||||
|
||||
void reslimit::reset_cancel() {
|
||||
lock_guard lock(*s_mux);
|
||||
lock_guard lock(g_rlimit_mux);
|
||||
set_cancel(0);
|
||||
}
|
||||
|
||||
void reslimit::inc_cancel() {
|
||||
lock_guard lock(*s_mux);
|
||||
lock_guard lock(g_rlimit_mux);
|
||||
set_cancel(m_cancel+1);
|
||||
}
|
||||
|
||||
void reslimit::dec_cancel() {
|
||||
lock_guard lock(*s_mux);
|
||||
lock_guard lock(g_rlimit_mux);
|
||||
if (m_cancel > 0) {
|
||||
set_cancel(m_cancel-1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue