summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--generic/tclEvent.c30
-rw-r--r--generic/tclInt.decls6
-rw-r--r--generic/tclIntDecls.h9
-rw-r--r--generic/tclStubInit.c3
-rw-r--r--mac/tclMacChan.c4
-rw-r--r--unix/tclUnixChan.c4
-rw-r--r--win/tclWinChan.c8
-rw-r--r--win/tclWinConsole.c8
-rw-r--r--win/tclWinPipe.c8
-rw-r--r--win/tclWinSerial.c8
11 files changed, 75 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index b689bbb..c3611ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
2002-11-06 Mo DeJong <mdejong@users.sourceforge.net>
+ * generic/tclEvent.c (TclInExit, TclInThreadExit):
+ Split out functionality of TclInExit to make it
+ clear which one should be called in each situation.
+ * generic/tclInt.decls: Declare TclInThreadExit.
+ * generic/tclIntDecls.h: Regen.
+ * generic/tclStubInit.c: Regen.
+ * mac/tclMacChan.c (StdIOClose):
+ * unix/tclUnixChan.c (FileCloseProc):
+ * win/tclWinChan.c (FileCloseProc):
+ * win/tclWinConsole.c (ConsoleCloseProc):
+ * win/tclWinPipe.c (TclpCloseFile):
+ * win/tclWinSerial.c (SerialCloseProc): Invoke the
+ new TclInThreadExit method instead of TclInExit.
+
+2002-11-06 Mo DeJong <mdejong@users.sourceforge.net>
+
* unix/configure: Regen.
* unix/tcl.m4 (SC_CONFIG_CFLAGS): Generate a fatal
configure error if no ar program can be found on the
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index 27365a4..957c5f6 100644
--- a/generic/tclEvent.c
+++ b/generic/tclEvent.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: tclEvent.c,v 1.23 2002/08/05 03:24:40 dgp Exp $
+ * RCS: @(#) $Id: tclEvent.c,v 1.24 2002/11/07 02:13:36 mdejong Exp $
*/
#include "tclInt.h"
@@ -878,10 +878,6 @@ Tcl_FinalizeThread()
(ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
if (tsdPtr != NULL) {
- /*
- * Invoke thread exit handlers first.
- */
-
tsdPtr->inExit = 1;
/*
@@ -937,10 +933,32 @@ Tcl_FinalizeThread()
int
TclInExit()
{
+ return inFinalize;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclInThreadExit --
+ *
+ * Determines if we are in the middle of thread exit-time cleanup.
+ *
+ * Results:
+ * If we are in the middle of exiting this thread, 1, otherwise 0.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TclInThreadExit()
+{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
TclThreadDataKeyGet(&dataKey);
if (tsdPtr == NULL) {
- return inFinalize;
+ return 0;
} else {
return tsdPtr->inExit;
}
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index b63ee4b..84b62f5 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -12,7 +12,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: tclInt.decls,v 1.56 2002/10/09 11:54:09 das Exp $
+# RCS: @(#) $Id: tclInt.decls,v 1.57 2002/11/07 02:13:36 mdejong Exp $
library tcl
@@ -686,6 +686,10 @@ declare 171 generic {
Tcl_Obj *CONST objv[])
}
+declare 172 generic {
+ int TclInThreadExit(void)
+}
+
##############################################################################
# Define the platform specific internal Tcl interface. These functions are
diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h
index b47f6fe..5c23144 100644
--- a/generic/tclIntDecls.h
+++ b/generic/tclIntDecls.h
@@ -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: tclIntDecls.h,v 1.47 2002/10/09 12:28:01 das Exp $
+ * RCS: @(#) $Id: tclIntDecls.h,v 1.48 2002/11/07 02:13:36 mdejong Exp $
*/
#ifndef _TCLINTDECLS
@@ -496,6 +496,8 @@ EXTERN int TclCheckExecutionTraces _ANSI_ARGS_((
int numChars, Command * cmdPtr, int result,
int traceFlags, int objc,
Tcl_Obj *CONST objv[]));
+/* 172 */
+EXTERN int TclInThreadExit _ANSI_ARGS_((void));
typedef struct TclIntStubs {
int magic;
@@ -697,6 +699,7 @@ typedef struct TclIntStubs {
int (*tclpUtfNcmp2) _ANSI_ARGS_((CONST char * s1, CONST char * s2, unsigned long n)); /* 169 */
int (*tclCheckInterpTraces) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * command, int numChars, Command * cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *CONST objv[])); /* 170 */
int (*tclCheckExecutionTraces) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * command, int numChars, Command * cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *CONST objv[])); /* 171 */
+ int (*tclInThreadExit) _ANSI_ARGS_((void)); /* 172 */
} TclIntStubs;
#ifdef __cplusplus
@@ -1299,6 +1302,10 @@ extern TclIntStubs *tclIntStubsPtr;
#define TclCheckExecutionTraces \
(tclIntStubsPtr->tclCheckExecutionTraces) /* 171 */
#endif
+#ifndef TclInThreadExit
+#define TclInThreadExit \
+ (tclIntStubsPtr->tclInThreadExit) /* 172 */
+#endif
#endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index e39a6d4..2d3136a 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStubInit.c,v 1.76 2002/10/09 11:54:48 das Exp $
+ * RCS: @(#) $Id: tclStubInit.c,v 1.77 2002/11/07 02:13:36 mdejong Exp $
*/
#include "tclInt.h"
@@ -243,6 +243,7 @@ TclIntStubs tclIntStubs = {
TclpUtfNcmp2, /* 169 */
TclCheckInterpTraces, /* 170 */
TclCheckExecutionTraces, /* 171 */
+ TclInThreadExit, /* 172 */
};
TclIntPlatStubs tclIntPlatStubs = {
diff --git a/mac/tclMacChan.c b/mac/tclMacChan.c
index b31d30a..ea261e9 100644
--- a/mac/tclMacChan.c
+++ b/mac/tclMacChan.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclMacChan.c,v 1.18 2002/10/09 11:54:16 das Exp $
+ * RCS: @(#) $Id: tclMacChan.c,v 1.19 2002/11/07 02:13:36 mdejong Exp $
*/
#include "tclInt.h"
@@ -425,7 +425,7 @@ StdIOClose(
*/
fd = (int) ((FileState*)instanceData)->fileRef;
- if (!TclInExit()) {
+ if (!TclInThreadExit()) {
if (fd == 0) {
tsdPtr->stdinChannel = NULL;
} else if (fd == 1) {
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index ef4ac89..4838c55 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixChan.c,v 1.39 2002/09/03 02:01:25 hobbs Exp $
+ * RCS: @(#) $Id: tclUnixChan.c,v 1.40 2002/11/07 02:13:37 mdejong Exp $
*/
#include "tclInt.h" /* Internal definitions for Tcl. */
@@ -549,7 +549,7 @@ FileCloseProc(instanceData, interp)
* Do not close standard channels while in thread-exit.
*/
- if (!TclInExit()
+ if (!TclInThreadExit()
|| ((fsPtr->fd != 0) && (fsPtr->fd != 1) && (fsPtr->fd != 2))) {
if (close(fsPtr->fd) < 0) {
errorCode = errno;
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index aa156bf..1a4c4ec 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinChan.c,v 1.24 2002/07/08 10:08:58 vincentdarley Exp $
+ * RCS: @(#) $Id: tclWinChan.c,v 1.25 2002/11/07 02:13:37 mdejong Exp $
*/
#include "tclWinInt.h"
@@ -397,11 +397,11 @@ FileCloseProc(instanceData, interp)
/*
* Don't close the Win32 handle if the handle is a standard channel
- * during the exit process. Otherwise, one thread may kill the stdio
- * of another.
+ * during the thread exit process. Otherwise, one thread may kill
+ * the stdio of another.
*/
- if (!TclInExit()
+ if (!TclInThreadExit()
|| ((GetStdHandle(STD_INPUT_HANDLE) != fileInfoPtr->handle)
&& (GetStdHandle(STD_OUTPUT_HANDLE) != fileInfoPtr->handle)
&& (GetStdHandle(STD_ERROR_HANDLE) != fileInfoPtr->handle))) {
diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c
index e864ab0..230a20e 100644
--- a/win/tclWinConsole.c
+++ b/win/tclWinConsole.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinConsole.c,v 1.8 2002/09/02 19:27:02 hobbs Exp $
+ * RCS: @(#) $Id: tclWinConsole.c,v 1.9 2002/11/07 02:13:37 mdejong Exp $
*/
#include "tclWinInt.h"
@@ -542,11 +542,11 @@ ConsoleCloseProc(
/*
* Don't close the Win32 handle if the handle is a standard channel
- * during the exit process. Otherwise, one thread may kill the stdio
- * of another.
+ * during the thread exit process. Otherwise, one thread may kill
+ * the stdio of another.
*/
- if (!TclInExit()
+ if (!TclInThreadExit()
|| ((GetStdHandle(STD_INPUT_HANDLE) != consolePtr->handle)
&& (GetStdHandle(STD_OUTPUT_HANDLE) != consolePtr->handle)
&& (GetStdHandle(STD_ERROR_HANDLE) != consolePtr->handle))) {
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index b02bb3b..2134d8d 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinPipe.c,v 1.25 2002/06/17 20:05:49 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclWinPipe.c,v 1.26 2002/11/07 02:13:37 mdejong Exp $
*/
#include "tclWinInt.h"
@@ -854,11 +854,11 @@ TclpCloseFile(
case WIN_FILE:
/*
* Don't close the Win32 handle if the handle is a standard channel
- * during the exit process. Otherwise, one thread may kill the
- * stdio of another.
+ * during the thread exit process. Otherwise, one thread may kill
+ * the stdio of another.
*/
- if (!TclInExit()
+ if (!TclInThreadExit()
|| ((GetStdHandle(STD_INPUT_HANDLE) != filePtr->handle)
&& (GetStdHandle(STD_OUTPUT_HANDLE) != filePtr->handle)
&& (GetStdHandle(STD_ERROR_HANDLE) != filePtr->handle))) {
diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c
index e5e69fa..a1cdcfd 100644
--- a/win/tclWinSerial.c
+++ b/win/tclWinSerial.c
@@ -11,7 +11,7 @@
*
* Serial functionality implemented by Rolf.Schroedter@dlr.de
*
- * RCS: @(#) $Id: tclWinSerial.c,v 1.21 2002/07/19 13:59:10 dkf Exp $
+ * RCS: @(#) $Id: tclWinSerial.c,v 1.22 2002/11/07 02:13:37 mdejong Exp $
*/
#include "tclWinInt.h"
@@ -632,11 +632,11 @@ SerialCloseProc(
/*
* Don't close the Win32 handle if the handle is a standard channel
- * during the exit process. Otherwise, one thread may kill the stdio
- * of another.
+ * during the thread exit process. Otherwise, one thread may kill
+ * the stdio of another.
*/
- if (!TclInExit()
+ if (!TclInThreadExit()
|| ((GetStdHandle(STD_INPUT_HANDLE) != serialPtr->handle)
&& (GetStdHandle(STD_OUTPUT_HANDLE) != serialPtr->handle)
&& (GetStdHandle(STD_ERROR_HANDLE) != serialPtr->handle))) {