Tech Tip: Controlling your processes when using RESUME/DELAY PROCESS commands
PRODUCT: 4D | VERSION: 15 | PLATFORM: Mac & Win
Published On: January 14, 2016
When using the DELAY PROCESS and RESUME PROCESS commands, it has the ability to not only control the processes you created but also what 4D has created as well. To prevent operations that may be necessary for 4D internal processes to run, a method RESUME_DELAY_PROCESS can focus on programatically created processes and not of internal 4D generated ones:
// --------------------------------------------------------------------------- // Name: RESUME_DELAY_PROCESS // Description: Method will check if the process is not by 4D internals to allow // RESUME PROCESS and DELAY PROCESS to be executed. // // Parameter: // $1 (LONGINT) - Process number // -------------------------------------------------------------------------- C_LONGINT($1;$process) C_LONGINT($procState;$procTime;$uniqueID;$origin) C_TEXT($procName) C_BOOLEAN($procVisible) If (Count parameters=1) $process:=$1 PROCESS PROPERTIES($process;$procName;$procState;$procTime;$procVisible;$uniqueID;$origin) If ($origin>0) Case of : (Process state($process)=Paused) RESUME PROCESS($process) : (Process state($process)=Delayed) DELAY PROCESS($process;0) End case End if End if |
Here is example of using the method RESUME_DELAY_PROCESS when using Count tasks in a loop to find all open processes in which both 4D and programmatically processes can be found:
C_LONGINT($Proc_i) For ($Proc_i;1;Count tasks) RESUME_DELAY_PROCESS ($Proc_i) End For |
See Also: