|
NAMEmtx_pool , mtx_pool_alloc ,
mtx_pool_find , mtx_pool_lock ,
mtx_pool_lock_spin ,
mtx_pool_unlock ,
mtx_pool_unlock_spin ,
mtx_pool_create ,
mtx_pool_destroy —
mutex pool routines
SYNOPSIS#include <sys/param.h>
#include <sys/lock.h>
#include <sys/mutex.h>
struct mtx *
struct mtx *
void
void
void
void
struct mtx_pool *
void
DESCRIPTIONMutex pools are designed to be used as short term leaf mutexes; i.e., the last mutex one might acquire before calling mtx_sleep(9). They operate using a shared pool of mutexes. A mutex may be chosen from the pool based on a supplied pointer, which may or may not point to anything valid, or the caller may allocate an arbitrary shared mutex from the pool and save the returned mutex pointer for later use.The shared mutexes in the mtxpool_sleep mutex pool, which is created by default, are standard, non-recursive, blockable mutexes, and should only be used in appropriate situations. The mutexes in the mtxpool_lockbuilder mutex pool are similar, except that they are initialized with the MTX_NOWITNESS flag so that they may be used to build higher-level locks. Other mutex pools may be created that contain mutexes with different properties, such as spin mutexes. The caller can lock and unlock mutexes returned by the pool routines, but since the mutexes are shared, the caller should not attempt to destroy them or modify their characteristics. While pool mutexes are normally leaf mutexes (meaning that one cannot depend on any ordering guarantees after obtaining one), one can still obtain other mutexes under carefully controlled circumstances. Specifically, if one has a private mutex (one that was allocated and initialized by the caller), one can obtain it after obtaining a pool mutex if ordering issues are carefully accounted for. In these cases the private mutex winds up being the true leaf mutex. Pool mutexes have the following advantages:
And the following disadvantages:
SEE ALSOlocking(9), mutex(9)HISTORYThese routines first appeared in FreeBSD 5.0.
Visit the GSP FreeBSD Man Page Interface. |