Manual Pages for UNIX Darwin command on man Tcl_FinalizeThread
MyWebUniversity

Manual Pages for UNIX Darwin command on man Tcl_FinalizeThread

TclExit(3) Tcl Library Procedures TclExit(3)

NAME

TclExit, TclFinalize, TclCreateExitHandler, TclDeleteExitHandler, TclExitThread, TclFinalizeThread, TclCreateThreadExitHandler,

TclDeleteThreadExitHandler - end the application or thread (and invoke

exit handlers)

SYNOPSIS

##iinncclluuddee <>

TTccllEExxiitt(status) TTccllFFiinnaalliizzee() TTccllCCrreeaatteeEExxiittHHaannddlleerr(proc, clientData) TTccllDDeelleetteeEExxiittHHaannddlleerr(proc, clientData) TTccllEExxiittTThhrreeaadd(status) TTccllFFiinnaalliizzeeTThhrreeaadd() TTccllCCrreeaatteeTThhrreeaaddEExxiittHHaannddlleerr(proc, clientData) TTccllDDeelleetteeTThhrreeaaddEExxiittHHaannddlleerr(proc, clientData) AARRGGUUMMEENNTTSS int status (in) Provides information about why the application or thread exited.

Exact meaning may be platform-

specific. 0 usually means a nor-

mal exit, any nonzero value usu-

ally means that an error occurred.

TclExitProc *proc (in) Procedure to invoke before exit-

ing application.

ClientData clientData (in) Arbitrary one-word value to pass

to proc.

DESCRIPTION

The procedures described here provide a graceful mechanism to end the execution of a TTccll application. Exit handlers are invoked to cleanup the application's state before ending the execution of TTccll code. Invoke TTccllEExxiitt to end a TTccll application and to exit from this process.

This procedure is invoked by the eexxiitt command, and can be invoked any-

place else to terminate the application. No-one should ever invoke the

eexxiitt system procedure directly; always invoke TTccllEExxiitt instead, so that it can invoke exit handlers. Note that if other code invokes eexxiitt

system procedure directly, or otherwise causes the application to ter-

minate without calling TTccllEExxiitt, the exit handlers will not be run. TTccllEExxiitt internally invokes the eexxiitt system call, thus it never returns control to its caller. TTccllFFiinnaalliizzee is similar to TTccllEExxiitt except that it does not exit from the current process. It is useful for cleaning up when a process is finished using TTccll but wishes to continue executing, and when TTccll is used in a dynamically loaded extension that is about to be unloaded. On some systems TTccll is automatically notified when it is being unloaded, and it calls TTccllFFiinnaalliizzee internally; on these systems it not necessary for the caller to explicitly call TTccllFFiinnaalliizzee. However, to ensure portability, your code should always invoke TTccllFFiinnaalliizzee when

TTccll is being unloaded, to ensure that the code will work on all plat-

forms. TTccllFFiinnaalliizzee can be safely called more than once.

TTccllEExxiittTThhrreeaadd is used to terminate the current thread and invoke per- |

thread exit handlers. This finalization is done by TTccllFFiinnaalliizzeeTThhrreeaadd, |

which you can call if you just want to clean up per-thread state and |

invoke the thread exit handlers. TTccllFFiinnaalliizzee calls TTccllFFiinnaalliizzeeTThhrreeaadd | for the current thread automatically. TTccllCCrreeaatteeEExxiittHHaannddlleerr arranges for proc to be invoked by TTccllFFiinnaalliizzee and TTccllEExxiitt. TTccllCCrreeaatteeTThhrreeaaddEExxiittHHaannddlleerr arranges for proc to be invoked by TTccllFFiinnaalliizzeeTThhrreeaadd and TTccllEExxiittTThhrreeaadd. This provides a hook

for cleanup operations such as flushing buffers and freeing global mem-

ory. Proc should match the type TTccllEExxiittPPrroocc: typedef void TclExitProc(ClientData clientData); The clientData parameter to proc is a copy of the clientData argument given to TTccllCCrreeaatteeEExxiittHHaannddlleerr or TTccllCCrreeaatteeTThhrreeaaddEExxiittHHaannddlleerr when the callback was created. Typically, clientData points to a data structure

containing application-specific information about what to do in proc.

TTccllDDeelleetteeEExxiittHHaannddlleerr and TTccllDDeelleetteeTThhrreeaaddEExxiittHHaannddlleerr may be called to

delete a previously-created exit handler. It removes the handler indi-

cated by proc and clientData so that no call to proc will be made. If

no such handler exists then TTccllDDeelleetteeEExxiittHHaannddlleerr or TTccllDDeelleetteeTThhrreeaadd-

EExxiittHHaannddlleerr does nothing. TTccllFFiinnaalliizzee and TTccllEExxiitt execute all registered exit handlers, in | reverse order from the order in which they were registered. This | matches the natural order in which extensions are loaded and unloaded; | if extension AA loads extension BB, it usually unloads BB before it itself | is unloaded. If extension AA registers its exit handlers before loading | extension BB, this ensures that any exit handlers for BB will be executed | before the exit handlers for AA. | TTccllFFiinnaalliizzee and TTccllEExxiitt call TTccllFFiinnaalliizzeeTThhrreeaadd and the thread exit |

handlers after the process-wide exit handlers. This is because thread |

finalization shuts down the I/O channel system, so any attempt at I/O | by the global exit handlers will vanish into the bitbucket. KKEEYYWWOORRDDSS callback, cleanup, dynamic loading, end application, exit, unloading, thread Tcl 8.1 TclExit(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™