4D v16.3

KILL WORKER

Home

 
4D v16.3
KILL WORKER

KILL WORKER 


 

KILL WORKER {( process )} 
Parameter Type   Description
process  Text, Longint in Number or name of process to kill (kills current process if omitted)

The KILL WORKER command posts a message to the worker process whose name or number you passed in process, asking it to ignore any pending messages and to terminate its execution as soon as the current task ends.

This command can only be used with worker processes. For more information, please refer to the About workers section.

In process, you pass either the name or number of the worker process whose execution needs to be terminated. If no worker with the specified process name or number exists, KILL WORKER does nothing.
If you do not pass any parameter, KILL WORKER applies to the currently running worker and is therefore equivalent to KILL WORKER (Current process).

If KILL WORKER is applied to a worker that was not created explicitly using the CALL WORKER command (for example, the main application worker), it only asks this worker to empty its message box. Consequently, KILL WORKER (1) does nothing.

Example  

The following code (executed from a form, for example) triggers the termination of a worker:

 CALL WORKER(vWorkerName;"theWorker";"end")

In the worker method (theWorker), you add some code to handle this situation:

  //theWorker method
 C_TEXT($1//param
 
 Case of
    :($1="call") //the worker is called
       ... //do something
    :($1="end") //the worker is asked to kill itself
       KILL WORKER
 End case



See also 

About workers
CALL WORKER
Current process name

 
PROPERTIES 

Product: 4D
Theme: Process (Communications)
Number: 1390

This command can be run in preemptive processes

 
HISTORY 

Created: 4D v15 R5

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)