3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-06 15:25:46 +00:00

turn locks into no-ops when compiled with -DSINGLE_THREAD

This commit is contained in:
Nuno Lopes 2019-06-05 12:11:27 +01:00
parent 9b375150eb
commit a53ff6f21c
17 changed files with 106 additions and 79 deletions

View file

@ -119,18 +119,18 @@ namespace api {
context::set_interruptable::set_interruptable(context & ctx, event_handler & i):
m_ctx(ctx) {
std::lock_guard<std::mutex> lock(ctx.m_mux);
lock_guard lock(ctx.m_mux);
SASSERT(m_ctx.m_interruptable == 0);
m_ctx.m_interruptable = &i;
}
context::set_interruptable::~set_interruptable() {
std::lock_guard<std::mutex> lock(m_ctx.m_mux);
lock_guard lock(m_ctx.m_mux);
m_ctx.m_interruptable = nullptr;
}
void context::interrupt() {
std::lock_guard<std::mutex> lock(m_mux);
lock_guard lock(m_mux);
if (m_interruptable)
(*m_interruptable)(API_INTERRUPT_EH_CALLER);
m_limit.cancel();