summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authormdejong <mdejong>2002-11-07 02:13:35 (GMT)
committermdejong <mdejong>2002-11-07 02:13:35 (GMT)
commit3e430e0f904e6835386a38276d1e7db4abe08e01 (patch)
treef86db515375673b4202dbd6719d7bd881da96117 /generic
parentc8da171d49ce9c4601c168ee22fb991d7a0da3b5 (diff)
downloadtcl-3e430e0f904e6835386a38276d1e7db4abe08e01.zip
tcl-3e430e0f904e6835386a38276d1e7db4abe08e01.tar.gz
tcl-3e430e0f904e6835386a38276d1e7db4abe08e01.tar.bz2
* 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.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclEvent.c30
-rw-r--r--generic/tclInt.decls6
-rw-r--r--generic/tclIntDecls.h9
-rw-r--r--generic/tclStubInit.c3
4 files changed, 39 insertions, 9 deletions
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 = {