Module Name:    src
Committed By:   darran
Date:           Thu Feb 25 11:12:02 UTC 2010

Modified Files:
        src/external/cddl/osnet/dist/uts/common/dtrace: dtrace.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
    src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c
diff -u src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.4 src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.5
--- src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.4	Wed Feb 24 21:08:54 2010
+++ src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c	Thu Feb 25 11:12:02 2010
@@ -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);
 	}

Reply via email to