easylogging++: enforce recursive mutex

This fixes a hang when logging something which causes some other
logging code to be called
This commit is contained in:
moneromooo-monero 2017-01-16 19:31:43 +00:00
parent 71ac698b78
commit 5161f16f4a
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3

View file

@ -1001,7 +1001,11 @@ namespace el {
public: public:
Mutex(void) { Mutex(void) {
# if ELPP_OS_UNIX # if ELPP_OS_UNIX
pthread_mutex_init(&m_underlyingMutex, nullptr); pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&m_underlyingMutex, &attr);
pthread_mutexattr_destroy(&attr);
# elif ELPP_OS_WINDOWS # elif ELPP_OS_WINDOWS
InitializeCriticalSection(&m_underlyingMutex); InitializeCriticalSection(&m_underlyingMutex);
# endif // ELPP_OS_UNIX # endif // ELPP_OS_UNIX