diff options
author | davygrvy <davygrvy@noemail.net> | 2006-01-05 04:50:23 (GMT) |
---|---|---|
committer | davygrvy <davygrvy@noemail.net> | 2006-01-05 04:50:23 (GMT) |
commit | d30394204e5aa9bd884f108fd8409a1e116cc35d (patch) | |
tree | 13167d6d7b630e5530d1945f169cc3764a7ba3fd /win | |
parent | 817a0a4149acd92597889957713b9cfe7fad97af (diff) | |
download | tcl-d30394204e5aa9bd884f108fd8409a1e116cc35d.zip tcl-d30394204e5aa9bd884f108fd8409a1e116cc35d.tar.gz tcl-d30394204e5aa9bd884f108fd8409a1e116cc35d.tar.bz2 |
* win/tclAppInit.c: WIN32 native console signal handler removed.
This was found to be interfering with TWAPI extension one. IMO,
special services such as signal handlers should best be done with
extensions to the core after discussions on c.l.t. about Roy
Terry's tclsh children of a real windows service shell.
FossilOrigin-Name: 60ffd276c94c9e5b1c6b719621bf35efe44b8eda
Diffstat (limited to 'win')
-rw-r--r-- | win/tclAppInit.c | 142 |
1 files changed, 1 insertions, 141 deletions
diff --git a/win/tclAppInit.c b/win/tclAppInit.c index 6b20dce..4156a74 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.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: tclAppInit.c,v 1.22 2005/07/24 22:56:45 dkf Exp $ + * RCS: @(#) $Id: tclAppInit.c,v 1.23 2006/01/05 04:50:24 davygrvy Exp $ */ #include "tcl.h" @@ -28,13 +28,6 @@ extern Tcl_PackageInitProc TclObjTest_Init; #if defined(__GNUC__) static void setargv(int *argcPtr, char ***argvPtr); #endif /* __GNUC__ */ -static BOOL WINAPI sigHandler(DWORD fdwCtrlType); -static Tcl_AsyncProc asyncExit; -static void AppInitExitHandler(ClientData clientData); - -static Tcl_AsyncHandler exitToken = NULL; -static DWORD exitErrorCode = 0; - /* *---------------------------------------------------------------------- @@ -136,20 +129,6 @@ Tcl_AppInit(interp) return TCL_ERROR; } - /* - * Install a signal handler to the win32 console tclsh is running in. - */ - - SetConsoleCtrlHandler(sigHandler, TRUE); - exitToken = Tcl_AsyncCreate(asyncExit, NULL); - - /* - * This exit handler will be used to free the resources allocated in this - * file. - */ - - Tcl_CreateExitHandler(AppInitExitHandler, NULL); - #ifdef TCL_TEST if (Tcltest_Init(interp) == TCL_ERROR) { return TCL_ERROR; @@ -211,38 +190,6 @@ Tcl_AppInit(interp) } /* - *---------------------------------------------------------------------- - * - * AppInitExitHandler -- - * - * This function is called to cleanup the app init resources before Tcl - * is unloaded. - * - * Results: - * None. - * - * Side effects: - * Frees the saved argv and deletes the async exit handler. - * - *---------------------------------------------------------------------- - */ - -static void -AppInitExitHandler( - ClientData clientData) /* Not Used. */ -{ - if (exitToken != NULL) { - /* - * This should be safe to do even if we are in an async exit right - * now. - */ - - Tcl_AsyncDelete(exitToken); - exitToken = NULL; - } -} - -/* *------------------------------------------------------------------------- * * setargv -- @@ -362,93 +309,6 @@ setargv(argcPtr, argvPtr) #endif /* __GNUC__ */ /* - *---------------------------------------------------------------------- - * - * asyncExit -- - * - * The AsyncProc for the exitToken. - * - * Results: - * doesn't actually return. - * - * Side effects: - * tclsh cleanly exits. - * - *---------------------------------------------------------------------- - */ - -int -asyncExit( - ClientData clientData, /* Not Used. */ - Tcl_Interp *interp, /* interp in context, if any. */ - int code) /* result of last command, if any. */ -{ - Tcl_Exit((int)exitErrorCode); - - /* NOTREACHED */ - return code; -} - -/* - *---------------------------------------------------------------------- - * - * sigHandler -- - * - * Signal handler for the Win32 OS. Catches Ctrl+C, Ctrl+Break and other - * exits. This is needed so tclsh can do it's real clean-up and not an - * unclean crash terminate. - * - * Results: - * TRUE. - * - * Side effects: - * Effects the way the app exits from a signal. This is an operating - * system supplied thread and unsafe to call ANY Tcl commands except for - * Tcl_AsyncMark. - * - *---------------------------------------------------------------------- - */ - -BOOL WINAPI -sigHandler( - DWORD fdwCtrlType) /* One of the CTRL_*_EVENT constants. */ -{ - HANDLE hStdIn; - - if (!exitToken) { - /* - * Async token must have been destroyed, punt gracefully. - */ - return FALSE; - } - - /* - * If Tcl is currently executing some bytecode or in the eventloop, this - * will cause Tcl to enter asyncExit at the next command boundry. - */ - - exitErrorCode = fdwCtrlType; - Tcl_AsyncMark(exitToken); - - /* - * This will cause Tcl_Gets in Tcl_Main() to drop-out with an <EOF> should - * it be blocked on input and our Tcl_AsyncMark didn't grab the attention - * of the interpreter. - */ - - hStdIn = GetStdHandle(STD_INPUT_HANDLE); - if (hStdIn) { - CloseHandle(hStdIn); - } - - /* - * Indicate to the OS not to call the default terminator. - */ - - return TRUE; -} - -/* * Local Variables: * mode: c * c-basic-offset: 4 |