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
35

DESCRIPTION

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

KEYWORDS

66       callback, clock, handler, timer
67
68
69
70Tcl                                   7.5            Tcl_CreateTimerHandler(3)
Impressum