KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Utility Method to determine if the process is Preemptive
PRODUCT: 4D | VERSION: 16 | PLATFORM: Mac & Win
Published On: October 5, 2017

Here is a code snippet that can help determine if a certain process is preemptive:

C_TEXT($vName)
C_LONGINT($vState;$vTime;$vFlags;$vlProcNum)
C_BOOLEAN($0)
If (Count parameters=1)
  C_LONGINT($1)
  $vlProcNum:=$1
Else
  $vlProcNum:=Current process
End if
PROCESS PROPERTIES($vlProcNum;$vName;$vState;$vTime;$vFlags)
$0:=$vFlags ?? 1 //true if preemptive


If the code above is saved as UTIL_ProcessIsPreemptive then it could be used like this to check if the current process is preemptive:
If (UTIL_ProcessIsPreemptive )
    // if current process is preemptive
   
   
End if


The project mehtod can be used like this to check a specific process number is preemptive:
If (UTIL_ProcessIsPreemptive (123))
    // if process # 123 is preemptive
   
   
End if