xref: /freebsd/contrib/jemalloc/src/mutex_pool.c (revision 4198293b2568c3fa287e7bde71162e9d442f4305)
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
mutex_pool_init(mutex_pool_t * pool,const char * name,witness_rank_t rank)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