From 323b868f7dfe5140b031b9bf17ad691d722e23b0 Mon Sep 17 00:00:00 2001 From: vasiljevic Date: Tue, 31 May 2005 08:18:31 +0000 Subject: Notifier thread is created as joinable. Attempt to solve the Tcl Bug #1082283. --- unix/tclUnixNotfy.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index d44144c..f4368c5 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixNotfy.c,v 1.11.2.9 2005/05/14 20:52:33 das Exp $ + * RCS: @(#) $Id: tclUnixNotfy.c,v 1.11.2.10 2005/05/31 08:18:31 vasiljevic Exp $ */ #ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier @@ -222,7 +222,7 @@ Tcl_InitNotifier() Tcl_MutexLock(¬ifierMutex); if (notifierCount == 0) { if (TclpThreadCreate(¬ifierThread, NotifierThreadProc, NULL, - TCL_THREAD_STACK_DEFAULT, TCL_THREAD_NOFLAGS) != TCL_OK) { + TCL_THREAD_STACK_DEFAULT, TCL_THREAD_JOINABLE) != TCL_OK) { panic("Tcl_InitNotifier: unable to start notifier thread"); } } @@ -275,11 +275,12 @@ Tcl_FinalizeNotifier(clientData) */ if (notifierCount == 0) { + int result; if (triggerPipe < 0) { panic("Tcl_FinalizeNotifier: notifier pipe not initialized"); } - /* + /* * Send "q" message to the notifier thread so that it will * terminate. The notifier will return from its call to select() * and notice that a "q" message has arrived, it will then close @@ -293,6 +294,10 @@ Tcl_FinalizeNotifier(clientData) close(triggerPipe); Tcl_ConditionWait(¬ifierCV, ¬ifierMutex, NULL); + result = Tcl_JoinThread(notifierThread); + if (result) { + Tcl_Panic("Tcl_FinalizeNotifier: unable to join notifier thread"); + } } /* -- cgit v0.12