FreeBSD/sys/kern/kern_umtx.c
/*
 * Unpropagate priority for a PI mutex when a thread blocked on
 * it is interrupted by signal or resumed by others.
 */
Unpropagate priority for a PI mutex when a thread blocked on
it is interrupted by signal or resumed by others.
Unpropagate priority for a PI mutex when a thread blocked on it is interrupted by signal or resumed by others .
static void
umtx_repropagate_priority(struct umtx_pi *pi)
{
	struct umtx_q *uq, *uq_owner;
	struct umtx_pi *pi2;
	int pri;
	mtx_assert(&umtx_lock, MA_OWNED);
	if (umtx_pi_check_loop(pi))
		return;
	while (pi != NULL && pi->pi_owner != NULL) {
		pri = PRI_MAX;
		uq_owner = pi->pi_owner->td_umtxq;
		TAILQ_FOREACH(pi2, &uq_owner->uq_pi_contested, pi_link) {
			uq = TAILQ_FIRST(&pi2->pi_blocked);
			if (uq != NULL) {
				if (pri > UPRI(uq->uq_thread))
					pri = UPRI(uq->uq_thread);
			}
		}
		if (pri > uq_owner->uq_inherited_pri)
			pri = uq_owner->uq_inherited_pri;
		thread_lock(pi->pi_owner);
		sched_lend_user_prio(pi->pi_owner, pri);
		thread_unlock(pi->pi_owner);
		if ((pi = uq_owner->uq_pi_blocked) != NULL)
			umtx_pi_adjust_thread(pi, uq_owner->uq_thread);
	}
}
static void umtx_repropagate_priority ( struct umtx_pi * pi ) { struct umtx_q * uq , * uq_owner ; struct umtx_pi * pi2 ; int pri ; mtx_assert ( & umtx_lock , MA_OWNED ) ; if ( umtx_pi_check_loop ( pi ) ) return ; while ( pi != NULL && pi -> pi_owner != NULL ) { pri = PRI_MAX ; uq_owner = pi -> pi_owner -> td_umtxq ; TAILQ_FOREACH ( pi2 , & uq_owner -> uq_pi_contested , pi_link ) { uq = TAILQ_FIRST ( & pi2 -> pi_blocked ) ; if ( uq != NULL ) { if ( pri > UPRI ( uq -> uq_thread ) ) pri = UPRI ( uq -> uq_thread ) ; } } if ( pri > uq_owner -> uq_inherited_pri ) pri = uq_owner -> uq_inherited_pri ; thread_lock ( pi -> pi_owner ) ; sched_lend_user_prio ( pi -> pi_owner , pri ) ; thread_unlock ( pi -> pi_owner ) ; if ( ( pi = uq_owner -> uq_pi_blocked ) != NULL ) umtx_pi_adjust_thread ( pi , uq_owner -> uq_thread ) ; } }
Unpropagate priority for a PI mutex when a thread blocked on
 it is interrupted by signal or resumed by others.
Unpropagate priority for a PI mutex when a thread blocked on it is interrupted by signal or resumed by others .