MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mtx_init

Function mtx_init

app/redis-6.2.6/deps/jemalloc/test/src/mtx.c:7–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#endif
6
7bool
8mtx_init(mtx_t *mtx) {
9#ifdef _WIN32
10 if (!InitializeCriticalSectionAndSpinCount(&mtx->lock,
11 _CRT_SPINCOUNT)) {
12 return true;
13 }
14#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
15 mtx->lock = OS_UNFAIR_LOCK_INIT;
16#elif (defined(JEMALLOC_OSSPIN))
17 mtx->lock = 0;
18#else
19 pthread_mutexattr_t attr;
20
21 if (pthread_mutexattr_init(&attr) != 0) {
22 return true;
23 }
24 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_DEFAULT);
25 if (pthread_mutex_init(&mtx->lock, &attr) != 0) {
26 pthread_mutexattr_destroy(&attr);
27 return true;
28 }
29 pthread_mutexattr_destroy(&attr);
30#endif
31 return false;
32}
33
34void
35mtx_fini(mtx_t *mtx) {

Callers 15

freebsd_crypt_newsessionFunction · 0.85
zvol_create_minor_implFunction · 0.85
vchiq_init_timerFunction · 0.85
init_completionFunction · 0.85
_sema_initFunction · 0.85
bcm_vchiq_attachFunction · 0.85
XX_InitSpinlockFunction · 0.85
blake2_attachFunction · 0.85
aesni_attachFunction · 0.85
armv8_crypto_attachFunction · 0.85
ccp_initialize_queuesFunction · 0.85
ccp_attachFunction · 0.85

Calls 1

pthread_mutex_initFunction · 0.85

Tested by

no test coverage detected