FreeBSD/sys/dev/usb/usb_process.c
/*------------------------------------------------------------------------*
 *	usb_proc_mwait
 *
 * This function will return when the USB process message pointed to
 * by "pm" is no longer on a queue. This function must be called
 * having "up->up_mtx" locked.
 *------------------------------------------------------------------------*/
usb_proc_mwait
This function will return when the USB process message pointed to
by "pm" is no longer on a queue. This function must be called
having "up->up_mtx" locked.
usb_proc_mwait This function will return when the USB process message pointed to by " pm " is no longer on a queue . This function must be called having " up - > up_mtx " locked .
void
usb_proc_mwait(struct usb_process *up, void *_pm0, void *_pm1)
{
	struct usb_proc_msg *pm0 = _pm0;
	struct usb_proc_msg *pm1 = _pm1;
	if (up->up_gone)
		return;
	mtx_assert(up->up_mtx, MA_OWNED);
	if (up->up_curtd == curthread) {
		if (pm0->pm_qentry.tqe_prev) {
			TAILQ_REMOVE(&up->up_qhead, pm0, pm_qentry);
			pm0->pm_qentry.tqe_prev = NULL;
		}
		if (pm1->pm_qentry.tqe_prev) {
			TAILQ_REMOVE(&up->up_qhead, pm1, pm_qentry);
			pm1->pm_qentry.tqe_prev = NULL;
		}
	} else
		while (pm0->pm_qentry.tqe_prev ||
		    pm1->pm_qentry.tqe_prev) {
			if (up->up_gone)
				break;
			up->up_dsleep = 1;
			cv_wait(&up->up_drain, up->up_mtx);
		}
}
void usb_proc_mwait ( struct usb_process * up , void * _pm0 , void * _pm1 ) { struct usb_proc_msg * pm0 = _pm0 ; struct usb_proc_msg * pm1 = _pm1 ; if ( up -> up_gone ) return ; mtx_assert ( up -> up_mtx , MA_OWNED ) ; if ( up -> up_curtd == curthread ) { if ( pm0 -> pm_qentry . tqe_prev ) { TAILQ_REMOVE ( & up -> up_qhead , pm0 , pm_qentry ) ; pm0 -> pm_qentry . tqe_prev = NULL ; } if ( pm1 -> pm_qentry . tqe_prev ) { TAILQ_REMOVE ( & up -> up_qhead , pm1 , pm_qentry ) ; pm1 -> pm_qentry . tqe_prev = NULL ; } } else while ( pm0 -> pm_qentry . tqe_prev || pm1 -> pm_qentry . tqe_prev ) { if ( up -> up_gone ) break ; up -> up_dsleep = 1 ; cv_wait ( & up -> up_drain , up -> up_mtx ) ; } }
usb_proc_mwait
 This function will return when the USB process message pointed to
 by "pm" is no longer on a queue.
usb_proc_mwait This function will return when the USB process message pointed to by " pm " is no longer on a queue .
/* check if gone */ /* Just remove the messages from the queue. */ /* check if config thread is gone */