MCPcopy Create free account
hub / github.com/F-Stack/f-stack / _intr_drain

Function _intr_drain

freebsd/kern/kern_intr.c:789–819  ·  view source on GitHub ↗

* Sleep until an ithread finishes executing an interrupt handler. * * XXX Doesn't currently handle interrupt filters or fast interrupt * handlers. This is intended for compatibility with linux drivers * only. Do not use in BSD code. */

Source from the content-addressed store, hash-verified

787 * only. Do not use in BSD code.
788 */
789void
790_intr_drain(int irq)
791{
792 struct intr_event *ie;
793 struct intr_thread *ithd;
794 struct thread *td;
795
796 ie = intr_lookup(irq);
797 if (ie == NULL)
798 return;
799 if (ie->ie_thread == NULL)
800 return;
801 ithd = ie->ie_thread;
802 td = ithd->it_thread;
803 /*
804 * We set the flag and wait for it to be cleared to avoid
805 * long delays with potentially busy interrupt handlers
806 * were we to only sample TD_AWAITING_INTR() every tick.
807 */
808 thread_lock(td);
809 if (!TD_AWAITING_INTR(td)) {
810 ithd->it_flags |= IT_WAIT;
811 while (ithd->it_flags & IT_WAIT) {
812 thread_unlock(td);
813 pause("idrain", 1);
814 thread_lock(td);
815 }
816 }
817 thread_unlock(td);
818 return;
819}
820
821int
822intr_event_remove_handler(void *cookie)

Callers

nothing calls this directly

Calls 1

intr_lookupFunction · 0.85

Tested by

no test coverage detected