mirror of
https://github.com/Z3Prover/z3
synced 2025-08-04 10:20:23 +00:00
turn locks into no-ops when compiled with -DSINGLE_THREAD
This commit is contained in:
parent
9b375150eb
commit
a53ff6f21c
17 changed files with 106 additions and 79 deletions
|
@ -18,9 +18,10 @@ Revision History:
|
|||
--*/
|
||||
#include "util/rlimit.h"
|
||||
#include "util/common_msgs.h"
|
||||
#include "util/mutex.h"
|
||||
|
||||
|
||||
static std::mutex g_rlimit_mux;
|
||||
static mutex g_rlimit_mux;
|
||||
|
||||
reslimit::reslimit():
|
||||
m_cancel(0),
|
||||
|
@ -72,34 +73,34 @@ char const* reslimit::get_cancel_msg() const {
|
|||
}
|
||||
|
||||
void reslimit::push_child(reslimit* r) {
|
||||
std::lock_guard<std::mutex> lock(g_rlimit_mux);
|
||||
lock_guard lock(g_rlimit_mux);
|
||||
m_children.push_back(r);
|
||||
}
|
||||
|
||||
void reslimit::pop_child() {
|
||||
std::lock_guard<std::mutex> lock(g_rlimit_mux);
|
||||
lock_guard lock(g_rlimit_mux);
|
||||
m_children.pop_back();
|
||||
}
|
||||
|
||||
void reslimit::cancel() {
|
||||
std::lock_guard<std::mutex> lock(g_rlimit_mux);
|
||||
lock_guard lock(g_rlimit_mux);
|
||||
set_cancel(m_cancel+1);
|
||||
}
|
||||
|
||||
|
||||
void reslimit::reset_cancel() {
|
||||
std::lock_guard<std::mutex> lock(g_rlimit_mux);
|
||||
lock_guard lock(g_rlimit_mux);
|
||||
set_cancel(0);
|
||||
}
|
||||
|
||||
void reslimit::inc_cancel() {
|
||||
std::lock_guard<std::mutex> lock(g_rlimit_mux);
|
||||
lock_guard lock(g_rlimit_mux);
|
||||
set_cancel(m_cancel+1);
|
||||
}
|
||||
|
||||
|
||||
void reslimit::dec_cancel() {
|
||||
std::lock_guard<std::mutex> lock(g_rlimit_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