Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

XtAppAddTimeOut(1)

XtRemoveTimeOut(1)

NAME

XtTimerCallbackProc − interface definition for procedure invoked when timeouts expire. 

Synopsis

typedef void (*XtTimerCallbackProc)(XtPointer, XtIntervalId *);

XtPointer client_data; XtIntervalId *id;

Inputs

client_data
Specifies the data that was registered with this procedure.

idSpecifies the ID returned when this procedure was registered. 

Description

An XtTimerCallbackProc is registered in a call to XtAppAddTimeOut(), and is invoked when the specified number of milliseconds elapse.  The client_data argument is data registered with the procedure in the call to XtAppAddTimeOut(), and the id argument is the value returned by that function.  A timer callback is called once, and then is automatically removed.  If you want a callback to be called repeatedly, re-register the callback each time it is called,

Example

The following XtTimerCallbackProc is from the xmh program.  It re-registers itself so that it will be called repeatedly.  Note that it uses its client_data argument to supply the application context so that it can re-register itself. 

/*ARGSUSED*/
static void NeedToCheckScans(client_data, id)
    XtPointer client_data;
    XtIntervalId *id;           /* unused */
{
    int i;
    if (!subProcessRunning) {
        DEBUG("[magic toc check ...")
        for (i = 0; i < numScrns; i++) {
            if (scrnList[i]->toc)
                TocRecheckValidity(scrnList[i]->toc);
            if (scrnList[i]->msg)
                TocRecheckValidity(MsgGetToc(scrnList[i]->msg));
        }
        DEBUG(" done]0)
    }
    (void) XtAppAddTimeOut((XtAppContext)client_data,
                           (unsigned long) app_resources.rescan_interval,
                           NeedToCheckScans, client_data);
}

This procedure is initiallly registered with the following code:

    if (app_resources.rescan_interval > 0) {
        app_resources.rescan_interval *= 60000;
        (void) XtAppAddTimeOut(appCtx,
                 (unsigned long) app_resources.rescan_interval,
                 NeedToCheckScans, (XtPointer)appCtx);
    }

See Also

XtAppAddTimeOut(1), XtRemoveTimeOut(1). 

Copyright O’Reilly & Assoc.  —  X Toolkit Intrinsics Reference Manual © O’Reilly & Associates

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026