tcl7.6 C API - Exit
NAME
Tcl_Exit, Tcl_CreateExitHandler, Tcl_DeleteExitHandler - end
the application (and invoke exit handlers)
SYNOPSIS
#include <tcl.h>
Tcl_Exit(status)
Tcl_CreateExitHandler(proc, clientData)
Tcl_DeleteExitHandler(proc, clientData)
ARGUMENTS
int status (in) Provides information
about why application
exited. Exact meaning
may be platform-
specific. 0 usually
means a normal exit, 1
means that an error
occurred.
Tcl_ExitProc *proc (in) Procedure to invoke
before exiting appli-
cation.
ClientData clientData (in) Arbitrary one-word
value to pass to proc.
DESCRIPTION
Tcl_Exit is the procedure that is invoked to end a Tcl
application. It is invoked by the exit command, as well as
anyplace else that terminates the application. No-one
should ever invoke the exit procedure directly; always
invoke Tcl_Exit instead, so that it can invoke exit
handlers.
Tcl_CreateExitHandler arranges for proc to be invoked by
Tcl_Exit before it terminates the application. This pro-
vides a hook for cleanup operations such as flushing buffers
and freeing global memory. Proc should have arguments and
return value that match the type Tcl_ExitProc:
typedef void Tcl_ExitProc(ClientData clientData);
The clientData parameter to proc is a copy of the clientData
argument given to Tcl_CreateExitHandler when the callback
was created. Typically, clientData points to a data struc-
ture containing application-specific information about what
to do in proc.
Tcl_DeleteExitHandler may be called to delete a previously-
created exit handler. It removes the handler indicated by
proc and clientData so that no call to proc will be made.
If no such handler exists then Tcl_DeleteExitHandler does
nothing.
KEYWORDS
callback, end application, exit