1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1990 The Regents of the University of California.
|
3 |
|
|
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
|
4 |
|
|
'\"
|
5 |
|
|
'\" See the file "license.terms" for information on usage and redistribution
|
6 |
|
|
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
7 |
|
|
'\"
|
8 |
|
|
'\" RCS: @(#) $Id: CrtTimerHdlr.3,v 1.1.1.1 2002-01-16 10:25:23 markom Exp $
|
9 |
|
|
'\"
|
10 |
|
|
.so man.macros
|
11 |
|
|
.TH Tcl_CreateTimerHandler 3 7.5 Tcl "Tcl Library Procedures"
|
12 |
|
|
.BS
|
13 |
|
|
.SH NAME
|
14 |
|
|
Tcl_CreateTimerHandler, Tcl_DeleteTimerHandler \- call a procedure at a
|
15 |
|
|
given time
|
16 |
|
|
.SH SYNOPSIS
|
17 |
|
|
.nf
|
18 |
|
|
\fB#include \fR
|
19 |
|
|
.sp
|
20 |
|
|
Tcl_TimerToken
|
21 |
|
|
\fBTcl_CreateTimerHandler\fR(\fImilliseconds, proc, clientData\fR)
|
22 |
|
|
.sp
|
23 |
|
|
\fBTcl_DeleteTimerHandler\fR(\fItoken\fR)
|
24 |
|
|
.SH ARGUMENTS
|
25 |
|
|
.AS Tcl_TimerToken milliseconds
|
26 |
|
|
.AP int milliseconds in
|
27 |
|
|
How many milliseconds to wait before invoking \fIproc\fR.
|
28 |
|
|
.AP Tcl_TimerProc *proc in
|
29 |
|
|
Procedure to invoke after \fImilliseconds\fR have elapsed.
|
30 |
|
|
.AP ClientData clientData in
|
31 |
|
|
Arbitrary one-word value to pass to \fIproc\fR.
|
32 |
|
|
.AP Tcl_TimerToken token in
|
33 |
|
|
Token for previously-created timer handler (the return value
|
34 |
|
|
from some previous call to \fBTcl_CreateTimerHandler\fR).
|
35 |
|
|
.BE
|
36 |
|
|
|
37 |
|
|
.SH DESCRIPTION
|
38 |
|
|
.PP
|
39 |
|
|
\fBTcl_CreateTimerHandler\fR arranges for \fIproc\fR to be
|
40 |
|
|
invoked at a time \fImilliseconds\fR milliseconds in the
|
41 |
|
|
future.
|
42 |
|
|
The callback to \fIproc\fR will be made by \fBTcl_DoOneEvent\fR,
|
43 |
|
|
so \fBTcl_CreateTimerHandler\fR is only useful in programs that
|
44 |
|
|
dispatch events through \fBTcl_DoOneEvent\fR or through Tcl commands
|
45 |
|
|
such as \fBvwait\fR.
|
46 |
|
|
The call to \fIproc\fR may not be made at the exact time given by
|
47 |
|
|
\fImilliseconds\fR: it will be made at the next opportunity
|
48 |
|
|
after that time. For example, if \fBTcl_DoOneEvent\fR isn't
|
49 |
|
|
called until long after the time has elapsed, or if there
|
50 |
|
|
are other pending events to process before the call to
|
51 |
|
|
\fIproc\fR, then the call to \fIproc\fR will be delayed.
|
52 |
|
|
.PP
|
53 |
|
|
\fIProc\fR should have arguments and return value that match
|
54 |
|
|
the type \fBTcl_TimerProc\fR:
|
55 |
|
|
.CS
|
56 |
|
|
typedef void Tcl_TimerProc(ClientData \fIclientData\fR);
|
57 |
|
|
.CE
|
58 |
|
|
The \fIclientData\fR parameter to \fIproc\fR is a
|
59 |
|
|
copy of the \fIclientData\fR argument given to
|
60 |
|
|
\fBTcl_CreateTimerHandler\fR when the callback
|
61 |
|
|
was created. Typically, \fIclientData\fR points to a data
|
62 |
|
|
structure containing application-specific information about
|
63 |
|
|
what to do in \fIproc\fR.
|
64 |
|
|
.PP
|
65 |
|
|
\fBTcl_DeleteTimerHandler\fR may be called to delete a
|
66 |
|
|
previously-created timer handler. It deletes the handler
|
67 |
|
|
indicated by \fItoken\fR so that no call to \fIproc\fR
|
68 |
|
|
will be made; if that handler no longer exists
|
69 |
|
|
(e.g. because the time period has already elapsed and \fIproc\fR
|
70 |
|
|
has been invoked then \fBTcl_DeleteTimerHandler\fR does nothing.
|
71 |
|
|
The tokens returned by \fBTcl_CreateTimerHandler\fR never have
|
72 |
|
|
a value of NULL, so if NULL is passed to \fBTcl_DeleteTimerHandler\fR
|
73 |
|
|
then the procedure does nothing.
|
74 |
|
|
|
75 |
|
|
.SH KEYWORDS
|
76 |
|
|
callback, clock, handler, timer
|