diff options
| author | Warner Losh <imp@FreeBSD.org> | 2006-05-24 17:22:53 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2006-05-24 17:22:53 +0000 |
| commit | 1b2ec08c94b3d09c95e11a877daf1965557ae40f (patch) | |
| tree | d428cd95d5913542d75cd8403de6b6970f25d70b /sys/dev/pccbb | |
| parent | 03d9e830c1302ce5c2acc5f621aab23f333c578c (diff) | |
Notes
Diffstat (limited to 'sys/dev/pccbb')
| -rw-r--r-- | sys/dev/pccbb/pccbb.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c index a9bf97a544460..387795f0d7299 100644 --- a/sys/dev/pccbb/pccbb.c +++ b/sys/dev/pccbb/pccbb.c @@ -330,7 +330,8 @@ cbb_detach(device_t brdev) mtx_lock(&sc->mtx); bus_teardown_intr(brdev, sc->irq_res, sc->intrhand); sc->flags |= CBB_KTHREAD_DONE; - if (sc->flags & CBB_KTHREAD_RUNNING) { + while (sc->flags & CBB_KTHREAD_RUNNING) { + DEVPRINTF((sc->dev, "Waiting for thread to die\n")); cv_broadcast(&sc->cv); msleep(sc->event_thread, &sc->mtx, PWAIT, "cbbun", 0); } @@ -481,7 +482,9 @@ cbb_event_thread(void *arg) int err; int not_a_card = 0; + mtx_lock(&sc->mtx); sc->flags |= CBB_KTHREAD_RUNNING; + mtx_unlock(&sc->mtx); while ((sc->flags & CBB_KTHREAD_DONE) == 0) { /* * We take out Giant here because we need it deep, @@ -538,7 +541,10 @@ cbb_event_thread(void *arg) err = cv_timedwait(&sc->cv, &sc->mtx, 1 * hz); mtx_unlock(&sc->mtx); } + DEVPRINTF((sc->dev, "Thread terminating\n")); + mtx_lock(&sc->mtx); sc->flags &= ~CBB_KTHREAD_RUNNING; + mtx_unlock(&sc->mtx); kthread_exit(0); } |
