## Tcl9.0.3/Tk9.0.3 Documentation > Tcl C API > CrtTimerHdlr

### Tcl/Tk Applications | Tcl Commands | Tk Commands | [incr Tcl] Package Commands | SQLite3 Package Commands | TDBC Package Commands | tdbc::mysql Package Commands | tdbc::odbc Package Commands | tdbc::postgres Package Commands | tdbc::sqlite3 Package Commands | Thread Package Commands | Tcl C API | Tk C API | [incr Tcl] Package C API | TDBC Package C API

  NAME
    Tcl_CreateTimerHandler, Tcl_DeleteTimerHandler — 与えられた時刻に手続函数を呼ぶ　 call a procedure at a given time
  SYNOPSIS
    #include <tcl.h>
    Tcl_TimerToken
    Tcl_CreateTimerHandler(milliseconds, proc, clientData)
    Tcl_DeleteTimerHandler(token)
  引数 ARGUMENTS
    int milliseconds (入力in)
    Tcl_TimerProc *proc (入力in)
    void *clientData (入力in)
    Tcl_TimerToken token (入力in)
  DESCRIPTION
  SEE ALSO
  KEYWORDS

### NAME

Tcl_CreateTimerHandler, Tcl_DeleteTimerHandler — 与えられた時刻に手続函数を呼ぶ　 call a procedure at a given time

### SYNOPSIS

#include <tcl.h>
Tcl_TimerToken
Tcl_CreateTimerHandler(milliseconds, proc, clientData)
Tcl_DeleteTimerHandler(token)

### 引数 ARGUMENTS

int milliseconds (入力in)
  proc を起動する迄に何厘秒待つべきか｡ How many milliseconds to wait before invoking proc.

Tcl_TimerProc *proc (入力in)
  milliseconds だけ経た後に起動する手続函数｡ Procedure to invoke after milliseconds have elapsed.

void *clientData (入力in)
  proc に渡す任意の１語値｡ Arbitrary one-word value to pass to proc.

Tcl_TimerToken token (入力in)
  以前に作成した時間処理機能の字句結果(何か以前の Tcl_CreateTimerHandler への呼出しからの返り値)｡ Token for previously created timer handler (the return value from some previous call to Tcl_CreateTimerHandler).

### DESCRIPTION

Tcl_CreateTimerHandler は将来 milliseconds 厘秒の時に起動される proc を手配する｡ proc への呼戻しは Tcl_DoOneEvent によってなされ､故に Tcl_CreateTimerHandler は Tcl_DoOneEvent 命令､或は､ vwait の様な Tcl 命令を経由して行事を急送する算譜内でのみ便利である｡ proc への呼び出しは milliseconds によって与えられる厳密な瞬間にはなされない: その時の後に次の機会が作られる｡譬えば､もし Tcl_DoOneEvent が長時間経過した後でなければ呼ばれない場合､亦はもし､ proc の呼出しの前に処理すべき別の未決の行事がある場合､ proc への呼び出しは遅延する｡ Tcl_CreateTimerHandler arranges for proc to be invoked at a time milliseconds milliseconds in the future. The callback to proc will be made by Tcl_DoOneEvent, so Tcl_CreateTimerHandler is only useful in programs that dispatch events through Tcl_DoOneEvent or through Tcl commands such as vwait. The call to proc may not be made at the exact time given by milliseconds: it will be made at the next opportunity after that time. For example, if Tcl_DoOneEvent is not called until long after the time has elapsed, or if there are other pending events to process before the call to proc, then the call to proc will be delayed.

proc は Tcl_TimerProc 型に合致する引数と返り値を有するべきである｡ Proc should have arguments and return value that match the type Tcl_TimerProc:

    typedef void Tcl_TimerProc(
            void *clientData);

proc への clientData 媒介変数は呼戻しが作られた時に Tcl_CreateTimerHandler に与えられた clientData 引数の複写である｡典型的には､ clientData は proc 内で行うべき事に関する応用譜固有の情報を含むデータ構造を指す｡ 　　　 The clientData parameter to proc is a copy of the clientData argument given to Tcl_CreateTimerHandler when the callback was created. Typically, clientData points to a data structure containing application-specific information about what to do in proc.

Tcl_DeleteTimerHandler は以前に作成された時間処理機能を削除する為に呼ばれるかもしれない｡ token によって指し示される処理機能を削除するので､ proc への呼出しはなされない｡もし､処理機能がもはや実在しない場合(譬えば､時間期間が既に経過し､proc が既に起動され､従って Tcl_DeleteTimerHandler は何もしない｡Tcl_CreateTimerHandler に返された字句結果は値 NULL を有することはないので､もし NULL が Tcl_DeleteTimerHandler に渡された場合は手続函数は何もしない｡ 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 will be made; if that handler no longer exists (e.g. because the time period has already elapsed and proc has been invoked then Tcl_DeleteTimerHandler does nothing. The tokens returned by Tcl_CreateTimerHandler never have a value of NULL, so if NULL is passed to Tcl_DeleteTimerHandler then the procedure does nothing.

### SEE ALSO

after, Tcl_CreateFileHandler, Tcl_DoWhenIdle

### KEYWORDS

callback, clock, handler, timer
Copyright © 1990 The Regents of the University of California.
Copyright © 1994-1996 Sun Microsystems, Inc.