XtAppAddWorkProc(3) XT FUNCTIONS XtAppAddWorkProc(3)NAME
XtAppAddWorkProc, XtRemoveWorkProc - Add and remove background processing procedures
SYNTAX
XtWorkProcId XtAppAddWorkProc(XtAppContext app_context, XtWorkProc proc, XtPointer client_data);
void XtRemoveWorkProc(XtWorkProcId id);
ARGUMENTS
app_context
Specifies the application context that identifies the application.
client_data
Specifies the argument that is to be passed to the specified procedure when it is called.
proc Specifies the procedure that is.
id Specifies which work procedure to remove.
DESCRIPTION
The XtAppAddWorkProc function adds the specified work procedure for the application identified by app_context.
The XtRemoveWorkProc function explicitly removes the specified background work procedure.
SEE ALSO XtAppNextEvent(3)
X Toolkit Intrinsics - C Language Interface
Xlib - C Language X Interface
X Version 11 libXt 1.1.3 XtAppAddWorkProc(3)
Check Out this Related Man Page
XtAppAddWorkProc() XtAppAddWorkProc()
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.
proc Specifies 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 AlsoXtAppNextEvent(1), XtAppProcessEvent(1), XtRemoveWorkProc(1),
XtWorkProc(2).
Xt - Event Handling XtAppAddWorkProc()