From ed448ee4de5f8c7cb4d8ffff46d486128774332d Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sat, 8 Oct 2005 06:51:47 +0000 Subject: [PATCH] MFP4: Note why we do the dance we do for waiting for the thread to die. --- sys/dev/pccbb/pccbb.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c index 2d88eab81a1..6b39e7da46a 100644 --- a/sys/dev/pccbb/pccbb.c +++ b/sys/dev/pccbb/pccbb.c @@ -306,6 +306,14 @@ cbb_detach(device_t brdev) * XXX buggy client drivers? */ bus_teardown_intr(brdev, sc->irq_res, sc->intrhand); + /* + * Wait for the thread to die. kthread_exit will do a wakeup + * on the event thread's struct thread * so that we know it is + * save to proceed. IF the thread is running, set the please + * die flag and wait for it to comply. Since the wakeup on + * the event thread happens only in kthread_exit, we don't + * need to loop here. + */ sc->flags |= CBB_KTHREAD_DONE; if (sc->flags & CBB_KTHREAD_RUNNING) { cv_broadcast(&sc->cv);