MXS-2067: Replace most SPINLOCKs

Replaced SPINLOCK with std::mutex where possible, leaving out the more
complex cases. The big offenders remaining are the binlogrouter and the
gateway.cc OpenSSL locks.
This commit is contained in:
Markus Mäkelä
2018-09-26 09:35:33 +03:00
parent 50451166bb
commit ab4f870927
17 changed files with 76 additions and 215 deletions

View File

@ -18,10 +18,22 @@
MXS_BEGIN_DECLS
#define SPINLOCK pthread_mutex_t
typedef pthread_mutex_t SPINLOCK;
#define SPINLOCK_INIT PTHREAD_MUTEX_INITIALIZER
#define spinlock_init(a) pthread_mutex_init(a, NULL)
#define spinlock_acquire(a) pthread_mutex_lock((pthread_mutex_t*)a)
#define spinlock_release(a) pthread_mutex_unlock((pthread_mutex_t*)a)
static inline void spinlock_init(SPINLOCK* a)
{
pthread_mutex_init(a, NULL);
}
static inline void spinlock_acquire(const SPINLOCK* a)
{
pthread_mutex_lock((SPINLOCK*)a);
}
static inline void spinlock_release(const SPINLOCK* a)
{
pthread_mutex_unlock((SPINLOCK*)a);
}
MXS_END_DECLS