Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/dist/uts/common/dtrace DTrace: fix a pro...



details:   https://anonhg.NetBSD.org/src/rev/6696a6abd93a
branches:  trunk
changeset: 752408:6696a6abd93a
user:      darran <darran%NetBSD.org@localhost>
date:      Thu Feb 25 11:12:02 2010 +0000

description:
DTrace: fix a problem with the code waiting for the deadman thread to exit
- now it does actually wait for it to exit.  Thanks to Frank Kardel for
spotting this.

diffstat:

 external/cddl/osnet/dist/uts/common/dtrace/dtrace.c |  10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diffs (38 lines):

diff -r 791c58bf4c56 -r 6696a6abd93a external/cddl/osnet/dist/uts/common/dtrace/dtrace.c
--- a/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c       Thu Feb 25 10:56:24 2010 +0000
+++ b/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c       Thu Feb 25 11:12:02 2010 +0000
@@ -248,6 +248,7 @@
 
 kmutex_t dtrace_deadman_mutex;
 void *dtrace_deadman_wchan; 
+void *dtrace_cleanup_wchan; 
 int dtrace_deadman_alive;                      /* deadman thread keep alive */
 lwp_t *dtrace_deadman_proc;
 #endif
@@ -12872,6 +12873,9 @@
            state->dts_alive = now;
        }
 
+       /* let the cleanup code know we're done */
+       dtrace_deadman_alive = -1;
+
        kthread_exit(0);
 }
 #endif
@@ -13729,10 +13733,16 @@
 
        /* Kill off the deadman thread */
        if (dtrace_deadman_alive) {
+           /* tell the deadman thread to exit */
            dtrace_deadman_alive = 0;
+           dtrace_cleanup_wchan = &dtrace_cleanup_wchan;
            wakeup(dtrace_deadman_wchan);
            /* Wait for thread to exit */
            mutex_enter(&dtrace_deadman_mutex);
+           do {
+                   mtsleep(&dtrace_cleanup_wchan, PRI_BIO,
+                           "deadman_exit", 10, &dtrace_deadman_mutex);
+           } while (!dtrace_deadman_alive);
            mutex_exit(&dtrace_deadman_mutex);
            mutex_destroy(&dtrace_deadman_mutex);
        }



Home | Main Index | Thread Index | Old Index