Application Developer Guide > Using the Widget Toolbox > Adding Work Procedures
  

Adding Work Procedures
Most applications spend most of their time waiting for events to occur. You can register a work procedure that will be called when the toolkit is idle (waiting for an event). The work procedure is the only means offered by the Xt Toolkit for performing background processing. A work procedure is useful if you need to execute a time-consuming operation from a callback procedure.
When a work procedure is added, it is executed in its entirety unless a REMOVE call to WtWorkProc is issued before the procedure has been called.
If the work procedure does a large amount of processing it could block the widget interface until it has finished running.
A typical implementation using WtWorkProc to perform a large amount of background processing is to break down the processing into a number of discrete steps and execute the steps one at a time in a work procedure which issues another ADD call to WtWorkProc to start the next step. Repeat this process until all the steps have been completed.
To register a work procedure, use the system function WtWorkProc:
status = WtWorkProc(function, parameters)
The function parameter is an Add or Remove operation. Add registers a named work procedure. The parameters used depend on whether an Add or Remove operation is specified.

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.