mirror of
https://github.com/Z3Prover/z3
synced 2025-08-27 05:26:01 +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
35
src/util/mutex.h
Normal file
35
src/util/mutex.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*++
|
||||
Copyright (c) 2019 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
mutex.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Auxiliary macros for mutual exclusion
|
||||
|
||||
--*/
|
||||
#pragma once
|
||||
|
||||
#ifdef SINGLE_THREAD
|
||||
|
||||
template<typename T> using atomic = T;
|
||||
|
||||
struct mutex {
|
||||
void lock() {}
|
||||
void unlock() {}
|
||||
};
|
||||
|
||||
struct lock_guard {
|
||||
lock_guard(mutex &) {}
|
||||
};
|
||||
|
||||
#else
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
|
||||
template<typename T> using atomic = std::atomic<T>;
|
||||
typedef std::mutex mutex;
|
||||
typedef std::lock_guard<std::mutex> lock_guard;
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue