xref: /freebsd/contrib/jemalloc/src/mutex_pool.c (revision a4e5e0106ac7145f56eb39a691e302cabb4635be)
1 #define JEMALLOC_MUTEX_POOL_C_
2 
3 #include "jemalloc/internal/jemalloc_preamble.h"
4 #include "jemalloc/internal/jemalloc_internal_includes.h"
5 
6 #include "jemalloc/internal/mutex.h"
7 #include "jemalloc/internal/mutex_pool.h"
8 
9 bool
10 mutex_pool_init(mutex_pool_t *pool, const char *name, witness_rank_t rank) {
11 	for (int i = 0; i < MUTEX_POOL_SIZE; ++i) {
12 		if (malloc_mutex_init(&pool->mutexes[i], name, rank,
13 		    malloc_mutex_address_ordered)) {
14 			return true;
15 		}
16 	}
17 	return false;
18 }
19