4D v16.3CALL WORKER |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
CALL WORKER
CALL WORKER
The CALL WORKER command creates or calls the worker process whose name or ID you passed in process, and requests the execution of the method in its context with the optional param parameter(s). The CALL WORKER command encapsulates the param parameters into a message and posts it in the worker's message box. For more information on worker processes, please refer to the About workers section. In the process parameter, you can specify the worker using its process name or its process number:
Notes:
The worker process appears in the list of processes of the Runtime Explorer and is returned by the PROCESS PROPERTIES command when applied to this process. In method, you pass the name of the project method to execute in the context of the worker process. You can pass an empty string; in this case, the worker executes the method that was originally used to start its process, if any (i.e., the startup method of the worker). Note: It is not possible to pass an empty string in method when the command calls the main process (process number 1) since it was not started using a project method. As a result, CALL WORKER (1;"") does nothing. You can also pass parameters to the method using one or more optional param parameters. You pass parameters the same way you would pass them to a subroutine (see the Passing Parameters to Methods section). Upon starting execution in the context of the process, the process method receives the parameter values in $1, $2, and so on. Remember that arrays cannot be passed as parameters to a method. Furthermore, in the context of the CALL WORKER command, the following additional considerations need to be taken into account:
A worker process remains alive until the application is closed or the KILL WORKER command is explicitly called for it. To free up memory, do not forget to call this command once a worker process is no longer needed. In a form, a button starts a computation: for example, statistics for the selected year. The button creates or calls a worker process that computes the data while the user can continue to work in the form. The method of the button is: //call the worker vWorkerName with the parameter The code of workerMethod is: // this is the method of the worker
See also
|
PROPERTIES
Product: 4D HISTORY
Created: 4D v15 R5 ARTICLE USAGE
4D Language Reference ( 4D v16) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||