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

NAME

8       Tcl_CreateTimerHandler,  Tcl_DeleteTimerHandler - call a procedure at a
9       given time
10

SYNOPSIS

12       #include <tcl.h>
13
14       Tcl_TimerToken
15       Tcl_CreateTimerHandler(milliseconds, proc, clientData)
16
17       Tcl_DeleteTimerHandler(token)
18

ARGUMENTS

20       int milliseconds (in)                     How many milliseconds to wait
21                                                 before invoking proc.
22
23       Tcl_TimerProc *proc (in)                  Procedure   to  invoke  after
24                                                 milliseconds have elapsed.
25
26       ClientData clientData (in)                Arbitrary one-word  value  to
27                                                 pass to proc.
28
29       Tcl_TimerToken token (in)                 Token  for previously created
30                                                 timer  handler  (the   return
31                                                 value from some previous call
32                                                 to Tcl_CreateTimerHandler).
33______________________________________________________________________________
34

DESCRIPTION

36       Tcl_CreateTimerHandler arranges for proc to be invoked at a  time  mil‐
37       liseconds  milliseconds  in  the  future.  The callback to proc will be
38       made by Tcl_DoOneEvent, so Tcl_CreateTimerHandler  is  only  useful  in
39       programs  that  dispatch  events  through Tcl_DoOneEvent or through Tcl
40       commands such as vwait.  The call to proc may not be made at the  exact
41       time  given  by  milliseconds:  it will be made at the next opportunity
42       after that time.  For example, if Tcl_DoOneEvent is  not  called  until
43       long  after  the time has elapsed, or if there are other pending events
44       to process before the call to proc, then the call to proc will  be  de‐
45       layed.
46
47       Proc  should  have  arguments  and  return  value  that  match the type
48       Tcl_TimerProc:
49
50              typedef void Tcl_TimerProc(
51                      ClientData clientData);
52
53       The clientData parameter to proc is a copy of the  clientData  argument
54       given  to  Tcl_CreateTimerHandler when the callback was created.  Typi‐
55       cally, clientData points to a data  structure  containing  application-
56       specific information about what to do in proc.
57
58       Tcl_DeleteTimerHandler  may  be  called  to delete a previously created
59       timer handler.  It deletes the handler indicated by token  so  that  no
60       call  to proc will be made;  if that handler no longer exists (e.g. be‐
61       cause the time period has already elapsed and  proc  has  been  invoked
62       then  Tcl_DeleteTimerHandler  does  nothing.   The  tokens  returned by
63       Tcl_CreateTimerHandler never have a value of NULL, so if NULL is passed
64       to Tcl_DeleteTimerHandler then the procedure does nothing.
65

SEE ALSO

67       after(n), Tcl_CreateFileHandler(3), Tcl_DoWhenIdle(3)
68

KEYWORDS

70       callback, clock, handler, timer
71
72
73
74Tcl                                   7.5            Tcl_CreateTimerHandler(3)
Impressum