mirror of
https://github.com/Z3Prover/z3
synced 2025-06-19 20:33:38 +00:00
mux
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
2788f72bbb
commit
9262908ebb
30 changed files with 191 additions and 341 deletions
|
@ -119,28 +119,22 @@ namespace api {
|
|||
|
||||
context::set_interruptable::set_interruptable(context & ctx, event_handler & i):
|
||||
m_ctx(ctx) {
|
||||
#pragma omp critical (set_interruptable)
|
||||
{
|
||||
SASSERT(m_ctx.m_interruptable == 0);
|
||||
m_ctx.m_interruptable = &i;
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(ctx.m_mux);
|
||||
SASSERT(m_ctx.m_interruptable == 0);
|
||||
m_ctx.m_interruptable = &i;
|
||||
}
|
||||
|
||||
context::set_interruptable::~set_interruptable() {
|
||||
#pragma omp critical (set_interruptable)
|
||||
{
|
||||
m_ctx.m_interruptable = nullptr;
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(m_ctx.m_mux);
|
||||
m_ctx.m_interruptable = nullptr;
|
||||
}
|
||||
|
||||
void context::interrupt() {
|
||||
#pragma omp critical (set_interruptable)
|
||||
{
|
||||
if (m_interruptable)
|
||||
(*m_interruptable)(API_INTERRUPT_EH_CALLER);
|
||||
m_limit.cancel();
|
||||
m().limit().cancel();
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(m_mux);
|
||||
if (m_interruptable)
|
||||
(*m_interruptable)(API_INTERRUPT_EH_CALLER);
|
||||
m_limit.cancel();
|
||||
m().limit().cancel();
|
||||
}
|
||||
|
||||
void context::set_error_code(Z3_error_code err, char const* opt_msg) {
|
||||
|
|
|
@ -42,6 +42,7 @@ Revision History:
|
|||
#include "ast/rewriter/seq_rewriter.h"
|
||||
#include "smt/smt_solver.h"
|
||||
#include "solver/solver.h"
|
||||
#include <mutex>
|
||||
|
||||
namespace smtlib {
|
||||
class parser;
|
||||
|
@ -79,6 +80,7 @@ namespace api {
|
|||
scoped_ptr<ast_manager> m_manager;
|
||||
scoped_ptr<cmd_context> m_cmd;
|
||||
add_plugins m_plugins;
|
||||
std::mutex m_mux;
|
||||
|
||||
arith_util m_arith_util;
|
||||
bv_util m_bv_util;
|
||||
|
|
|
@ -16,6 +16,7 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<fstream>
|
||||
#include<mutex>
|
||||
#include "api/z3.h"
|
||||
#include "api/api_log_macros.h"
|
||||
#include "util/util.h"
|
||||
|
@ -23,6 +24,7 @@ Revision History:
|
|||
|
||||
std::ostream * g_z3_log = nullptr;
|
||||
bool g_z3_log_enabled = false;
|
||||
static std::mutex g_log_mux;
|
||||
|
||||
extern "C" {
|
||||
void Z3_close_log_unsafe(void) {
|
||||
|
@ -37,7 +39,7 @@ extern "C" {
|
|||
bool res = true;
|
||||
|
||||
#ifdef Z3_LOG_SYNC
|
||||
#pragma omp critical (z3_log)
|
||||
std::lock_guard<std::mutex> lock(g_log_mux);
|
||||
{
|
||||
#endif
|
||||
if (g_z3_log != nullptr)
|
||||
|
@ -64,7 +66,7 @@ extern "C" {
|
|||
if (g_z3_log == nullptr)
|
||||
return;
|
||||
#ifdef Z3_LOG_SYNC
|
||||
#pragma omp critical (z3_log)
|
||||
std::lock_guard<std::mutex> lock(g_log_mux);
|
||||
{
|
||||
#endif
|
||||
if (g_z3_log != nullptr)
|
||||
|
@ -77,7 +79,7 @@ extern "C" {
|
|||
void Z3_API Z3_close_log(void) {
|
||||
if (g_z3_log != nullptr) {
|
||||
#ifdef Z3_LOG_SYNC
|
||||
#pragma omp critical (z3_log)
|
||||
std::lock_guard<std::mutex> lock(g_log_mux);
|
||||
{
|
||||
#endif
|
||||
Z3_close_log_unsafe();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue