3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 20:05:51 +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

@ -17,12 +17,9 @@ Revision History:
--*/
#include<sstream>
#include<mutex>
#include "util/mutex.h"
#include "util/util.h"
#include "util/rational.h"
#ifdef _WINDOWS
#include<strsafe.h>
#endif
synch_mpq_manager * rational::g_mpq_manager = nullptr;
rational rational::m_zero;
@ -43,11 +40,11 @@ static void mk_power_up_to(vector<rational> & pws, unsigned n) {
}
}
static std::mutex g_powers_of_two;
static mutex g_powers_of_two;
rational rational::power_of_two(unsigned k) {
rational result;
std::lock_guard<std::mutex> lock(g_powers_of_two);
lock_guard lock(g_powers_of_two);
{
if (k >= m_powers_of_two.size())
mk_power_up_to(m_powers_of_two, k+1);