summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authormdejong <mdejong@noemail.net>2002-11-07 02:13:35 (GMT)
committermdejong <mdejong@noemail.net>2002-11-07 02:13:35 (GMT)
commit5eaa499a632bc6ecd456ac1faa409fdef624e070 (patch)
treef86db515375673b4202dbd6719d7bd881da96117 /generic
parentfdd7933bc7031a5752f663bb798bce3332d4444f (diff)
downloadtcl-5eaa499a632bc6ecd456ac1faa409fdef624e070.zip
tcl-5eaa499a632bc6ecd456ac1faa409fdef624e070.tar.gz
tcl-5eaa499a632bc6ecd456ac1faa409fdef624e070.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. FossilOrigin-Name: de2cfbf168c353f2de6ec6db06bfb347b0ce9640
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 = {