mirror of
https://github.com/Z3Prover/z3
synced 2025-04-25 10:05:32 +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
|
@ -135,9 +135,14 @@ inline void swap(mpz & m1, mpz & m2) { m1.swap(m2); }
|
|||
template<bool SYNCH = true>
|
||||
class mpz_manager {
|
||||
mutable small_object_allocator m_allocator;
|
||||
mutable std::recursive_mutex m_lock;
|
||||
#define MPZ_BEGIN_CRITICAL() if (SYNCH) m_lock.lock();
|
||||
#define MPZ_END_CRITICAL() if (SYNCH) m_lock.unlock();
|
||||
#ifndef SINGLE_THREAD
|
||||
mutable std::recursive_mutex m_lock;
|
||||
#define MPZ_BEGIN_CRITICAL() if (SYNCH) m_lock.lock()
|
||||
#define MPZ_END_CRITICAL() if (SYNCH) m_lock.unlock()
|
||||
#else
|
||||
#define MPZ_BEGIN_CRITICAL() {}
|
||||
#define MPZ_END_CRITICAL() {}
|
||||
#endif
|
||||
mutable mpn_manager m_mpn_manager;
|
||||
|
||||
#ifndef _MP_GMP
|
||||
|
@ -702,7 +707,11 @@ public:
|
|||
bool decompose(mpz const & n, svector<digit_t> & digits);
|
||||
};
|
||||
|
||||
#ifndef SINGLE_THREAD
|
||||
typedef mpz_manager<true> synch_mpz_manager;
|
||||
#else
|
||||
typedef mpz_manager<false> synch_mpz_manager;
|
||||
#endif
|
||||
typedef mpz_manager<false> unsynch_mpz_manager;
|
||||
|
||||
typedef _scoped_numeral<unsynch_mpz_manager> scoped_mpz;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue