diff options
author | joerg <joerg@FreeBSD.org> | 2004-09-24 20:28:00 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 2004-09-24 20:28:00 +0000 |
commit | eba049f8c4d58ca3c86b1855775f2aa6e570cab6 (patch) | |
tree | d42011aa98641a1aa08b4baac220d743962ef5b7 /sys/dev/fdc | |
parent | 896afb32775acc05ae4211de9b0b337b72287551 (diff) | |
download | FreeBSD-src-eba049f8c4d58ca3c86b1855775f2aa6e570cab6.zip FreeBSD-src-eba049f8c4d58ca3c86b1855775f2aa6e570cab6.tar.gz |
Protect fdc->flags within the worker thread, too.
Use kthread_exit() instead of falling through the end of the worker
thread's main function. Since kthread_exit() wakeup(9)s everyone
sleeping on the thread handle, drop the superfluous wakeup() call.
Diffstat (limited to 'sys/dev/fdc')
-rw-r--r-- | sys/dev/fdc/fdc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index e44f030..6b179da 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -1140,8 +1140,10 @@ fdc_thread(void *arg) fdc = arg; int i; + mtx_lock(&fdc->fdc_mtx); fdc->flags |= FDC_KTHREAD_ALIVE; while ((fdc->flags & FDC_KTHREAD_EXIT) == 0) { + mtx_unlock(&fdc->fdc_mtx); i = fdc_worker(fdc); if (i && debugflags & 0x20) { if (fdc->bp != NULL) { @@ -1151,9 +1153,12 @@ fdc_thread(void *arg) printf("Retry line %d\n", retry_line); } fdc->retry += i; + mtx_lock(&fdc->fdc_mtx); } fdc->flags &= ~(FDC_KTHREAD_EXIT | FDC_KTHREAD_ALIVE); - wakeup(&fdc->fdc_thread); + mtx_unlock(&fdc->fdc_mtx); + + kthread_exit(0); } /* |