FreeBSD/sys/kern/kern_mtxpool.c
/*
 * Obtain a (shared) mutex from the pool.  The returned mutex is a leaf
 * level mutex, meaning that if you obtain it you cannot obtain any other
 * mutexes until you release it.  You can legally msleep() on the mutex.
 */
Obtain a (shared) mutex from the pool.  The returned mutex is a leaf
level mutex, meaning that if you obtain it you cannot obtain any other
mutexes until you release it.  You can legally msleep() on the mutex.
Obtain a ( shared ) mutex from the pool . The returned mutex is a leaf level mutex meaning that if you obtain it you cannot obtain any other mutexes until you release it . You can legally msleep () on the mutex .
struct mtx *
mtx_pool_alloc(struct mtx_pool *pool)
{
	int i;
	KASSERT(pool != NULL, ("mtx_pool_alloc(): null pool"));
	i = pool->mtx_pool_next;
	pool->mtx_pool_next = (i + 1) & pool->mtx_pool_mask;
	return (&pool->mtx_pool_ary[i]);
}
struct mtx * mtx_pool_alloc ( struct mtx_pool * pool ) { int i ; KASSERT ( pool != NULL , ( " " ) ) ; i = pool -> mtx_pool_next ; pool -> mtx_pool_next = ( i + 1 ) & pool -> mtx_pool_mask ; return ( & pool -> mtx_pool_ary [ i ] ) ; }
Obtain a (shared) mutex from the pool.
Obtain a ( shared ) mutex from the pool .
/*
	 * mtx_pool_next is unprotected against multiple accesses,
	 * but simultaneous access by two CPUs should not be very
	 * harmful.
	 */