KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Waking up processes that are either delayed or paused
PRODUCT: 4D | VERSION: 16 | PLATFORM: Mac & Win
Published On: June 21, 2018
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

The following method is a safe wrapper for waking up processes. The wrapper first checks the status of the process and branches accordingly in code.

- If the process is not a user process (origin<0) then do nothing
- If the process is a user process (origin>0) then perform the following actions:
- If the process is PAUSED the wrapper uses the command RESUME PROCESS to wake it up.
- If the process is DELAYED the wrapper uses the command DELAY PROCESS to wake it up.

// wake up process properly
C_LONGINT($1;$proc;$state;$time;$mode;$uid;$origin)
C_TEXT($name)
If (Count parameters=1)
    $proc:=$1
    PROCESS PROPERTIES($proc;$name;$state;$time;$mode;$uid;$origin)
    If ($origin>0)
       // only execute this against user created processes
     Case of
      : ($state=Delayed)
        DELAY PROCESS($proc;0)
      : ($state=Paused)
        RESUME PROCESS($proc)
     End case
    Else
       // not a user created process = do nothing
    End if
Else
    // no parameters = do nothing
End if




If the code above is saved as wakeUpProcess then it could be used like this:

wakeUpProcess(10)