1 /* 2 * mtx is a slightly simplified version of malloc_mutex. This code duplication 3 * is unfortunate, but there are allocator bootstrapping considerations that 4 * would leak into the test infrastructure if malloc_mutex were used directly 5 * in tests. 6 */ 7 8 typedef struct { 9 #ifdef _WIN32 10 CRITICAL_SECTION lock; 11 #elif (defined(JEMALLOC_OSSPIN)) 12 OSSpinLock lock; 13 #else 14 pthread_mutex_t lock; 15 #endif 16 } mtx_t; 17 18 bool mtx_init(mtx_t *mtx); 19 void mtx_fini(mtx_t *mtx); 20 void mtx_lock(mtx_t *mtx); 21 void mtx_unlock(mtx_t *mtx); 22