CrtTimerHdlr.3
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:3k
- '"
- '" Copyright (c) 1990 The Regents of the University of California.
- '" Copyright (c) 1994-1996 Sun Microsystems, Inc.
- '"
- '" See the file "license.terms" for information on usage and redistribution
- '" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- '"
- '" RCS: @(#) $Id: CrtTimerHdlr.3,v 1.2 1998/09/14 18:39:47 stanton Exp $
- '"
- .so man.macros
- .TH Tcl_CreateTimerHandler 3 7.5 Tcl "Tcl Library Procedures"
- .BS
- .SH NAME
- Tcl_CreateTimerHandler, Tcl_DeleteTimerHandler - call a procedure at a
- given time
- .SH SYNOPSIS
- .nf
- fB#include <tcl.h>fR
- .sp
- Tcl_TimerToken
- fBTcl_CreateTimerHandlerfR(fImilliseconds, proc, clientDatafR)
- .sp
- fBTcl_DeleteTimerHandlerfR(fItokenfR)
- .SH ARGUMENTS
- .AS Tcl_TimerToken milliseconds
- .AP int milliseconds in
- How many milliseconds to wait before invoking fIprocfR.
- .AP Tcl_TimerProc *proc in
- Procedure to invoke after fImillisecondsfR have elapsed.
- .AP ClientData clientData in
- Arbitrary one-word value to pass to fIprocfR.
- .AP Tcl_TimerToken token in
- Token for previously-created timer handler (the return value
- from some previous call to fBTcl_CreateTimerHandlerfR).
- .BE
- .SH DESCRIPTION
- .PP
- fBTcl_CreateTimerHandlerfR arranges for fIprocfR to be
- invoked at a time fImillisecondsfR milliseconds in the
- future.
- The callback to fIprocfR will be made by fBTcl_DoOneEventfR,
- so fBTcl_CreateTimerHandlerfR is only useful in programs that
- dispatch events through fBTcl_DoOneEventfR or through Tcl commands
- such as fBvwaitfR.
- The call to fIprocfR may not be made at the exact time given by
- fImillisecondsfR: it will be made at the next opportunity
- after that time. For example, if fBTcl_DoOneEventfR isn't
- called until long after the time has elapsed, or if there
- are other pending events to process before the call to
- fIprocfR, then the call to fIprocfR will be delayed.
- .PP
- fIProcfR should have arguments and return value that match
- the type fBTcl_TimerProcfR:
- .CS
- typedef void Tcl_TimerProc(ClientData fIclientDatafR);
- .CE
- The fIclientDatafR parameter to fIprocfR is a
- copy of the fIclientDatafR argument given to
- fBTcl_CreateTimerHandlerfR when the callback
- was created. Typically, fIclientDatafR points to a data
- structure containing application-specific information about
- what to do in fIprocfR.
- .PP
- fBTcl_DeleteTimerHandlerfR may be called to delete a
- previously-created timer handler. It deletes the handler
- indicated by fItokenfR so that no call to fIprocfR
- will be made; if that handler no longer exists
- (e.g. because the time period has already elapsed and fIprocfR
- has been invoked then fBTcl_DeleteTimerHandlerfR does nothing.
- The tokens returned by fBTcl_CreateTimerHandlerfR never have
- a value of NULL, so if NULL is passed to fBTcl_DeleteTimerHandlerfR
- then the procedure does nothing.
- .SH KEYWORDS
- callback, clock, handler, timer