diff options
| author | ferrieux@users.sourceforge.net <ferrieux> | 2011-08-09 17:19:33 (GMT) |
|---|---|---|
| committer | ferrieux@users.sourceforge.net <ferrieux> | 2011-08-09 17:19:33 (GMT) |
| commit | 032000cca6d57a3d317ecbe2b2798b649c4ff7b0 (patch) | |
| tree | 82fd16a3ebffc1553c7b6bb3847e036f9fd6cc61 /generic/tclEvent.c | |
| parent | 623d17cd799d504dde63708c622e4f31b87d6708 (diff) | |
| download | tcl-032000cca6d57a3d317ecbe2b2798b649c4ff7b0.zip tcl-032000cca6d57a3d317ecbe2b2798b649c4ff7b0.tar.gz tcl-032000cca6d57a3d317ecbe2b2798b649c4ff7b0.tar.bz2 | |
[Bug 2919042] Restore "valgrindability" of Tcl that was lost by the streamlining of [exit], by conditionally forcing a full Finalize: use -DPURIFY or ::env(TCL_FINALIZE_ON_EXIT)
Diffstat (limited to 'generic/tclEvent.c')
| -rw-r--r-- | generic/tclEvent.c | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 6816487..e65862c 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -953,27 +953,38 @@ Tcl_Exit( currentAppExitPtr(INT2PTR(status)); Tcl_Panic("AppExitProc returned unexpectedly"); } else { - /* - * Use default handling. - */ - InvokeExitHandlers(); + if (TclFullFinalizationRequested()) { - /* - * Ensure the thread-specific data is initialised as it is used in - * Tcl_FinalizeThread() - */ - - (void) TCL_TSD_INIT(&dataKey); - - /* - * Now finalize the calling thread only (others are not safely - * reachable). Among other things, this triggers a flush of the - * Tcl_Channels that may have data enqueued. - */ - - Tcl_FinalizeThread(); - + /* + * Thorough finalization for Valgrind et al. + */ + + Tcl_Finalize(); + + } else { + + /* + * Fast and deterministic exit (default behavior) + */ + + InvokeExitHandlers(); + + /* + * Ensure the thread-specific data is initialised as it is used in + * Tcl_FinalizeThread() + */ + + (void) TCL_TSD_INIT(&dataKey); + + /* + * Now finalize the calling thread only (others are not safely + * reachable). Among other things, this triggers a flush of the + * Tcl_Channels that may have data enqueued. + */ + + Tcl_FinalizeThread(); + } TclpExit(status); Tcl_Panic("OS exit failed!"); } |
