Tk_DoWhenIdle(proc, clientData)
Tk_CancelIdleCall(proc, clientData)
Proc should have arguments and result that match the type Tk_IdleProc:
Tk_CancelIdleCall may be used to cancel one or more previous calls to Tk_DoWhenIdle: if there is a Tk_DoWhenIdle handler registered for proc and clientData, then it is removed without invoking it. If there is more than one handler on the idle list that refers to proc and clientData, all of the handlers are removed. If no existing handlers match proc and clientData then nothing happens.
Tk_DoWhenIdle is most useful in situations where (a) a piece of work will have to be done but (b) it's possible that something will happen in the near future that will change what has to be done, or require something different to be done. Tk_DoWhenIdle allows the actual work to be deferred until all pending events have been processed. At this point the exact work to be done will presumably be known and it can be done exactly once.
For example, Tk_DoWhenIdle might be used by an editor to defer display updates until all pending commands have been processed. Without this feature, redundant redisplays might occur in some situations, such as the processing of a command file.
Copyright © 1990 The Regents of the University of California. Copyright © 1994 Sun Microsystems, Inc. Copyright © 1995 Roger E. Critchlow Jr.