Seth Woolley's Man Viewer

Tcl_CreateTimerHandler(3) - Tcl_CreateTimerHandler, Tcl_DeleteTimerHandler - call a procedure at a given time - man 3 Tcl_CreateTimerHandler

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

Tcl_CreateTimerHandler(3)   Tcl Library Procedures   Tcl_CreateTimerHandler(3)



______________________________________________________________________________

NAME
       Tcl_CreateTimerHandler,  Tcl_DeleteTimerHandler - call a procedure at a
       given time(1,2,n)

SYNOPSIS
       #include <tcl.h>

       Tcl_TimerToken
       Tcl_CreateTimerHandler(milliseconds, proc(5,n), clientData)

       Tcl_DeleteTimerHandler(token)

ARGUMENTS
       int              milliseconds   (in(1,8))      How many milliseconds to wait
                                                 before invoking proc(5,n).

       Tcl_TimerProc    *proc(5,n)          (in(1,8))      Procedure   to  invoke  after
                                                 milliseconds have elapsed.

       ClientData       clientData     (in(1,8))      Arbitrary one-word  value  to
                                                 pass to proc(5,n).

       Tcl_TimerToken   token          (in(1,8))      Token  for previously-created
                                                 timer  handler  (the   return
                                                 value from some previous call
                                                 to Tcl_CreateTimerHandler).
_________________________________________________________________


DESCRIPTION
       Tcl_CreateTimerHandler arranges for proc(5,n) to be invoked at a  time(1,2,n)  mil-
       liseconds  milliseconds  in(1,8)  the  future.  The callback to proc(5,n) will be
       made by Tcl_DoOneEvent, so Tcl_CreateTimerHandler  is  only  useful  in(1,8)
       programs  that  dispatch  events  through Tcl_DoOneEvent or through Tcl
       commands such as vwait.  The call to proc(5,n) may not be made at the  exact
       time(1,2,n)  given  by  milliseconds:  it will be made at the next opportunity
       after that time.  For example, if(3,n)  Tcl_DoOneEvent  isn't  called  until
       long  after  the time(1,2,n) has elapsed, or if(3,n) there are other pending events
       to process before the call to proc(5,n), then  the  call  to  proc(5,n)  will  be
       delayed.

       Proc  should  have  arguments  and  return  value  that  match the type
       Tcl_TimerProc:
              typedef void Tcl_TimerProc(ClientData clientData);
       The clientData parameter to proc(5,n) is a copy of the  clientData  argument
       given  to  Tcl_CreateTimerHandler when the callback was created.  Typi-
       cally, clientData points to a data  structure  containing  application-
       specific information about what to do in(1,8) proc(5,n).

       Tcl_DeleteTimerHandler  may  be  called  to delete a previously-created
       timer handler.  It deletes the handler indicated by token  so  that  no
       call  to  proc(5,n)  will  be  made;  if(3,n) that handler no longer exists (e.g.
       because the time(1,2,n) period has already elapsed and proc(5,n) has  been  invoked
       then  Tcl_DeleteTimerHandler  does  nothing.   The  tokens  returned by
       Tcl_CreateTimerHandler never have a value of NULL, so if(3,n) NULL is passed
       to Tcl_DeleteTimerHandler then the procedure does nothing.


KEYWORDS
       callback, clock(3,n), handler, timer



Tcl                                   7.5            Tcl_CreateTimerHandler(3)

References for this manual (incoming links)