mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:14:14 +08:00
mdbx: PTHREAD_MUTEX_ERRORCHECK при MDBX_DEBUG > 0.
This commit is contained in:
parent
1943db7d41
commit
ad4d00677b
12
src/osal.c
12
src/osal.c
@ -503,8 +503,18 @@ MDBX_INTERNAL_FUNC int osal_fastmutex_init(osal_fastmutex_t *fastmutex) {
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
InitializeCriticalSection(fastmutex);
|
||||
return MDBX_SUCCESS;
|
||||
#elif MDBX_DEBUG
|
||||
pthread_mutexattr_t ma;
|
||||
int rc = pthread_mutexattr_init(&ma);
|
||||
if (likely(!rc)) {
|
||||
rc = pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_ERRORCHECK);
|
||||
if (likely(!rc) || rc == ENOTSUP)
|
||||
rc = pthread_mutex_init(fastmutex, &ma);
|
||||
pthread_mutexattr_destroy(&ma);
|
||||
}
|
||||
return rc;
|
||||
#else
|
||||
return pthread_mutex_init(fastmutex, NULL);
|
||||
return pthread_mutex_init(fastmutex, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user