FreeBSD/sys/i386/bios/apm.c
/*
 * APM thread loop.
 *
 * This routine wakes up from time to time to deal with delaying the
 * suspend of the system, or other events.
 */
APM thread loop.
This routine wakes up from time to time to deal with delaying the
suspend of the system, or other events.
APM thread loop . This routine wakes up from time to time to deal with delaying the suspend of the system or other events .
static void
apm_event_thread(void *arg)
{
	struct apm_softc *sc = &apm_softc;
	sc->running = 1;
	while (sc->active) {
		if (apm_op_inprog)
			apm_lastreq_notify();
		if (sc->standbys && sc->standby_countdown-- <= 0)
			apm_do_standby();
		if (sc->suspends && sc->suspend_countdown-- <= 0)
			apm_do_suspend();
		if (!sc->bios_busy)
			apm_processevent();
		mtx_lock(&sc->mtx);
		cv_timedwait(&sc->cv, &sc->mtx, 10 * hz / 9);
		mtx_unlock(&sc->mtx);
	}
	sc->running = 0;
	kproc_exit(0);
}
static void apm_event_thread ( void * arg ) { struct apm_softc * sc = & apm_softc ; sc -> running = 1 ; while ( sc -> active ) { if ( apm_op_inprog ) apm_lastreq_notify ( ) ; if ( sc -> standbys && sc -> standby_countdown -- <= 0 ) apm_do_standby ( ) ; if ( sc -> suspends && sc -> suspend_countdown -- <= 0 ) apm_do_suspend ( ) ; if ( ! sc -> bios_busy ) apm_processevent ( ) ; mtx_lock ( & sc -> mtx ) ; cv_timedwait ( & sc -> cv , & sc -> mtx , 10 * hz / 9 ) ; mtx_unlock ( & sc -> mtx ) ; } sc -> running = 0 ; kproc_exit ( 0 ) ; }
APM thread loop.
APM thread loop .