Preemptive processes are very useful for performing extensive calculations in parallel, using all of the cores in your CPU, but sometimes you need to delegate tasks to a cooperative process (e.g., using a non-preemptive command). With the New signal command, you can pause a process and wait for the response from another process!
The New signal command creates a shared object and allows you to manage the interruption and continuity of the current process. Two methods are available for this:
In the example below, we need to open a form from a preemptive process. Since the Open form window command isn’t preemptive, the main process is called to open the form, and the calling process is put on hold until the user enters a value.
First, write a method that calls the main process and wait for the result:
// Creation of a signal
// call main process and execute OpenForm method
// do another calculation
// Waiting for the end of the process
// Calculate the results
Then the OpenForm method will wake up the process with the trigger method:
// Open the form and ask the user for a value
$win:=Open form window("Information";Movable form dialog box)
// Add a new attribute to $signal to pass result to other process
// Trigger the signal for the waiting process