1Tcl_CallWhenDeleted(3)      Tcl Library Procedures      Tcl_CallWhenDeleted(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tcl_CallWhenDeleted,  Tcl_DontCallWhenDeleted  -  Arrange  for callback
9       when interpreter is deleted
10

SYNOPSIS

12       #include <tcl.h>
13
14       Tcl_CallWhenDeleted(interp, proc, clientData)
15
16       Tcl_DontCallWhenDeleted(interp, proc, clientData)
17

ARGUMENTS

19       Tcl_Interp *interp (in)                       Interpreter with which to
20                                                     associated callback.
21
22       Tcl_InterpDeleteProc *proc (in)               Procedure  to  call  when
23                                                     interp is deleted.
24
25       ClientData clientData (in)                    Arbitrary one-word  value
26                                                     to pass to proc.
27______________________________________________________________________________
28

DESCRIPTION

30       Tcl_CallWhenDeleted  arranges for proc to be called by Tcl_DeleteInterp
31       if/when interp is deleted at some future time.  Proc  will  be  invoked
32       just  before the interpreter is deleted, but the interpreter will still
33       be valid at the time of the call.  Proc should have arguments  and  re‐
34       sult that match the type Tcl_InterpDeleteProc:
35
36              typedef void Tcl_InterpDeleteProc(
37                      ClientData clientData,
38                      Tcl_Interp *interp);
39
40       The  clientData  and interp parameters are copies of the clientData and
41       interp arguments given to Tcl_CallWhenDeleted.   Typically,  clientData
42       points to an application-specific data structure that proc uses to per‐
43       form cleanup when an interpreter is about to go away.   Proc  does  not
44       return a value.
45
46       Tcl_DontCallWhenDeleted  cancels a previous call to Tcl_CallWhenDeleted
47       with the same arguments, so that proc will not be called after all when
48       interp  is  deleted.  If there is no deletion callback that matches in‐
49       terp, proc, and clientData then the call to Tcl_DontCallWhenDeleted has
50       no effect.
51
52       Note  that if the callback is being used to delete a resource that must
53       be released on exit, Tcl_CreateExitHandler should  be  used  to  ensure
54       that  a callback is received even if the application terminates without
55       deleting the interpreter.
56

SEE ALSO

58       Tcl_CreateExitHandler(3), Tcl_CreateThreadExitHandler(3)
59

KEYWORDS

61       callback, cleanup, delete, interpreter
62
63
64
65Tcl                                   7.0               Tcl_CallWhenDeleted(3)
Impressum