FreeBSD/sys/kern/kern_umtx.c
/*
 * Decrease reference count for a PI mutex, if the counter
 * is decreased to zero, its memory space is freed.
 */
Decrease reference count for a PI mutex, if the counter
is decreased to zero, its memory space is freed.
Decrease reference count for a PI mutex if the counter is decreased to zero its memory space is freed .
static void
umtx_pi_unref(struct umtx_pi *pi)
{
	struct umtxq_chain *uc;
	uc = umtxq_getchain(&pi->pi_key);
	UMTXQ_LOCKED_ASSERT(uc);
	KASSERT(pi->pi_refcount > 0, ("invalid reference count"));
	if (--pi->pi_refcount == 0) {
		mtx_lock(&umtx_lock);
		if (pi->pi_owner != NULL)
			umtx_pi_disown(pi);
		KASSERT(TAILQ_EMPTY(&pi->pi_blocked),
			("blocked queue not empty"));
		mtx_unlock(&umtx_lock);
		TAILQ_REMOVE(&uc->uc_pi_list, pi, pi_hashlink);
		umtx_pi_free(pi);
	}
}
static void umtx_pi_unref ( struct umtx_pi * pi ) { struct umtxq_chain * uc ; uc = umtxq_getchain ( & pi -> pi_key ) ; UMTXQ_LOCKED_ASSERT ( uc ) ; KASSERT ( pi -> pi_refcount > 0 , ( " " ) ) ; if ( -- pi -> pi_refcount == 0 ) { mtx_lock ( & umtx_lock ) ; if ( pi -> pi_owner != NULL ) umtx_pi_disown ( pi ) ; KASSERT ( TAILQ_EMPTY ( & pi -> pi_blocked ) , ( " " ) ) ; mtx_unlock ( & umtx_lock ) ; TAILQ_REMOVE ( & uc -> uc_pi_list , pi , pi_hashlink ) ; umtx_pi_free ( pi ) ; } }
Decrease reference count for a PI mutex, if the counter
 is decreased to zero, its memory space is freed.
Decrease reference count for a PI mutex if the counter is decreased to zero its memory space is freed .