mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
remove cooperate
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
42ac3a5363
commit
e0d8cefde4
52 changed files with 0 additions and 204 deletions
|
@ -16,7 +16,6 @@ z3_add_component(util
|
|||
bit_vector.cpp
|
||||
cmd_context_types.cpp
|
||||
common_msgs.cpp
|
||||
cooperate.cpp
|
||||
debug.cpp
|
||||
env_params.cpp
|
||||
fixed_bit_vector.cpp
|
||||
|
@ -63,7 +62,6 @@ z3_add_component(util
|
|||
EXTRA_REGISTER_MODULE_HEADERS
|
||||
env_params.h
|
||||
MEMORY_INIT_FINALIZER_HEADERS
|
||||
cooperate.h
|
||||
debug.h
|
||||
gparams.h
|
||||
prime_generator.h
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
cooperate.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Cooperation support
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo (leonardo) 2011-05-17
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef SINGLE_THREAD
|
||||
|
||||
#include "util/cooperate.h"
|
||||
#include "util/trace.h"
|
||||
#include "util/debug.h"
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
static std::mutex* s_mux = nullptr;
|
||||
|
||||
void initialize_cooperate() {
|
||||
s_mux = new std::mutex();
|
||||
}
|
||||
void finalize_cooperate() {
|
||||
delete s_mux;
|
||||
}
|
||||
|
||||
static std::atomic<std::thread::id> owner_thread;
|
||||
|
||||
bool cooperation_ctx::g_cooperate = false;
|
||||
|
||||
void cooperation_ctx::checkpoint(char const * task) {
|
||||
SASSERT(cooperation_ctx::enabled());
|
||||
|
||||
std::thread::id tid = std::this_thread::get_id();
|
||||
if (owner_thread == tid) {
|
||||
owner_thread = std::thread::id();
|
||||
s_mux->unlock();
|
||||
}
|
||||
|
||||
// this critical section is used to force the owner thread to give a chance to
|
||||
// another thread to get the lock
|
||||
std::this_thread::yield();
|
||||
s_mux->lock();
|
||||
TRACE("cooperate_detail", tout << task << ", tid: " << tid << "\n";);
|
||||
owner_thread = tid;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,50 +0,0 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
cooperate.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Cooperation support
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo (leonardo) 2011-05-17
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#pragma once
|
||||
|
||||
#ifndef SINGLE_THREAD
|
||||
|
||||
class cooperation_ctx {
|
||||
static bool g_cooperate;
|
||||
public:
|
||||
static bool enabled() { return g_cooperate; }
|
||||
static void checkpoint(char const * task);
|
||||
};
|
||||
|
||||
inline void cooperate(char const * task) {
|
||||
if (cooperation_ctx::enabled()) cooperation_ctx::checkpoint(task);
|
||||
}
|
||||
|
||||
void initialize_cooperate();
|
||||
void finalize_cooperate();
|
||||
|
||||
#else
|
||||
inline void cooperate(char const *) {}
|
||||
inline void initialize_cooperate() {}
|
||||
inline void finalize_cooperate() {}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
ADD_INITIALIZER('initialize_cooperate();')
|
||||
ADD_FINALIZER('finalize_cooperate();')
|
||||
*/
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue