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

@ -409,11 +409,10 @@ void mxs_crypt(const char* password, const char* salt, char* output)
char* pw = crypt_r(password, salt, &cdata);
snprintf(output, MXS_CRYPT_SIZE, "%s", pw);
#else
static SPINLOCK mxs_crypt_lock = SPINLOCK_INIT;
spinlock_acquire(&mxs_crypt_lock);
static std::mutex mxs_crypt_lock;
std::lock_guard<std::mutex> guard(mxs_crypt_lock);
char* pw = crypt(password, salt);
snprintf(output, MXS_CRYPT_SIZE, "%s", pw);
spinlock_release(&mxs_crypt_lock);
#endif
}