FreeBSD/sys/compat/linuxkpi/common/src/linux_compat.c
/*
 * Indefinite wait for done != 0 with or without signals.
 */
Indefinite wait for done != 0 with or without signals.
Indefinite wait for done ! = 0 with or without signals .
long
linux_wait_for_common(struct completion *c, int flags)
{
	if (SCHEDULER_STOPPED())
		return (0);
	if (flags != 0)
		flags = SLEEPQ_INTERRUPTIBLE | SLEEPQ_SLEEP;
	else
		flags = SLEEPQ_SLEEP;
	for (;;) {
		sleepq_lock(c);
		if (c->done)
			break;
		sleepq_add(c, NULL, "completion", flags, 0);
		if (flags & SLEEPQ_INTERRUPTIBLE) {
			if (sleepq_wait_sig(c, 0) != 0)
				return (-ERESTARTSYS);
		} else
			sleepq_wait(c, 0);
	}
	c->done--;
	sleepq_release(c);
	return (0);
}
long linux_wait_for_common ( struct completion * c , int flags ) { if ( SCHEDULER_STOPPED ( ) ) return ( 0 ) ; if ( flags != 0 ) flags = SLEEPQ_INTERRUPTIBLE | SLEEPQ_SLEEP ; else flags = SLEEPQ_SLEEP ; for ( ; ; ) { sleepq_lock ( c ) ; if ( c -> done ) break ; sleepq_add ( c , NULL , " " , flags , 0 ) ; if ( flags & SLEEPQ_INTERRUPTIBLE ) { if ( sleepq_wait_sig ( c , 0 ) != 0 ) return ( - ERESTARTSYS ) ; } else sleepq_wait ( c , 0 ) ; } c -> done -- ; sleepq_release ( c ) ; return ( 0 ) ; }
Indefinite wait for done != 0 with or without signals.
Indefinite wait for done ! = 0 with or without signals .