FreeBSD/sys/kern/subr_sleepqueue.c
/*
 * Resume all threads sleeping on a specified wait channel.
 */
Resume all threads sleeping on a specified wait channel.
Resume all threads sleeping on a specified wait channel .
int
sleepq_broadcast(void *wchan, int flags, int pri, int queue)
{
	struct sleepqueue *sq;
	struct thread *td;
	int wakeup_swapper;
	CTR2(KTR_PROC, "sleepq_broadcast(%p, %d)", wchan, flags);
	KASSERT(wchan != NULL, ("%s: invalid NULL wait channel", __func__));
	MPASS((queue >= 0) && (queue < NR_SLEEPQS));
	sq = sleepq_lookup(wchan);
	if (sq == NULL)
		return (0);
	KASSERT(sq->sq_type == (flags & SLEEPQ_TYPE),
	    ("%s: mismatch between sleep/wakeup and cv_*", __func__));
	wakeup_swapper = 0;
	while ((td = TAILQ_FIRST(&sq->sq_blocked[queue])) != NULL) {
		thread_lock(td);
		wakeup_swapper |= sleepq_resume_thread(sq, td, pri);
		thread_unlock(td);
	}
	return (wakeup_swapper);
}
int sleepq_broadcast ( void * wchan , int flags , int pri , int queue ) { struct sleepqueue * sq ; struct thread * td ; int wakeup_swapper ; CTR2 ( KTR_PROC , " " , wchan , flags ) ; KASSERT ( wchan != NULL , ( " " , __func__ ) ) ; MPASS ( ( queue >= 0 ) && ( queue < NR_SLEEPQS ) ) ; sq = sleepq_lookup ( wchan ) ; if ( sq == NULL ) return ( 0 ) ; KASSERT ( sq -> sq_type == ( flags & SLEEPQ_TYPE ) , ( " " , __func__ ) ) ; wakeup_swapper = 0 ; while ( ( td = TAILQ_FIRST ( & sq -> sq_blocked [ queue ] ) ) != NULL ) { thread_lock ( td ) ; wakeup_swapper |= sleepq_resume_thread ( sq , td , pri ) ; thread_unlock ( td ) ; } return ( wakeup_swapper ) ; }
Resume all threads sleeping on a specified wait channel.
Resume all threads sleeping on a specified wait channel .
/* Resume all blocked threads on the sleep queue. */