Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ AppAWrkProc(3X) — DeltaWindows 1.3.3 Release 4 Version 4.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

 

NAME

XtAppAddWorkProc — register a procedure to be called when the event loop is idle. 

SYNOPSIS

XtWorkProcId XtAppAddWorkProc(app_context, proc, client_data)
    XtAppContext app_context;
    XtWorkProc proc;
    XtPointer client_data;

Inputs

app_context
Specifies the application context.

procSpecifies the procedure that is to be called when the application is idle. 

client_data
Specifies data to be passed to proc when it is called. 

Returns

A handle of type XtWorkProcId that can be passed to XtRemoveWorkProc() to unregister the work procedure. 

DESCRIPTION

XtAddWorkProc() registers the procedure proc and the data client_data to be called by XtAppNextEvent() or XtAppProcessEvent() when there are no pending input events and it would otherwise block.  Multiple work procedures can be registered, and the most recently added one is always the one that is called.  However, if a work procedure itself adds another work procedure, the newly added one has lower priority than the current one. 

A work procedure returns a Boolean.  If it returns True, it will automatically be unregistered and will not be called again.  If it returns False it will be called the next time the application is idle.  See XtWorkProc(2) for more information. 

USAGE

XtAppAddWorkProc() implements a limited form of background processing.  Most applications spend most of their time waiting for input; to do useful work during this idle time, you can register a work procedure that will run when the application is idle. 

A work procedure must return quickly or the application will not be able to promptly respond to user events.  If a large task needs to be done in the background, the work procedure should periodically save its state and return False.  Work procedures should not be used to do frivolous work in the background.  In a multi-tasking system, an idle application should generally actually be idle, and not steal CPU time from other processes. 

A work procedure can be explicitly removed by calling XtRemoveWorkProc() with the XtWorkProcId returned by this function. 

STRUCTURES

The XtWorkProcId type is defined as follows: typedef unsigned long XtWorkProcId;

SEE ALSO

XtAppNextEventUNIX SYSTEM V/68, XtAppProcessEventUNIX SYSTEM V/68, XtRemoveWorkProcUNIX SYSTEM V/68,
XtWorkProcUNIX SYSTEM V/88. 

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