Skip to main content
Version: Next

PROCESS PROPERTIES

PROCESS PROPERTIES ( process ; procName ; procState ; procTime {; procMode {; uniqueID {; origin}}} )

ParameterTypeDescription
processLongint🡒Process number
procNameString🡘Process name
procStateLongint🡘Process state
procTimeLongint🡘Cumulative time taken by process in ticks
procModeBoolean, Longint🡘If Boolean: Visible (True) or Hidden (False)
If Longint (bit field): bit 0 = Visibility, bit 1 = Preemptive execution
uniqueIDLongint🡘Unique process ID
originLongint🡘Origin of the process

Description

The PROCESS PROPERTIES command returns various information about the process whose process number you pass in process.

Note: If the process does not exist, which means you did not pass in process a number in the range 1 to Count tasks, PROCESS PROPERTIES leaves the variable parameters unchanged.

After the call:

  • procName returns the name of the process. Some things to note about the process name:

    • If the process was started from the Execute Method dialog box (with the New Process option selected), its name is “P_” followed by a number.
    • If the process was started from a custom menu item whose Start a New Process property is checked, the name of the process is “M_” or “ML_” followed by a number.
    • If the process was started by the Web server, its name is "Web Process#" followed by an UUID.
    • If the process has been aborted (and its “slot” not reused yet), the name of the process is still returned. To detect if a process is aborted, test procState=-1 (see below).
  • procState returns the state of the process at the moment of the call. This parameter can return one of the values provided by the following predefined constants:
    | Constant | Type | Value |
    | ------------------------- | ------- | ----- |
    | Does not exist | Longint | -100 |
    | Aborted | Longint | -1 |
    | Executing | Longint | 0 |
    | Delayed | Longint | 1 |
    | Waiting for user event | Longint | 2 |
    | Waiting for input output | Longint | 3 |
    | Waiting for internal flag | Longint | 4 |
    | Paused | Longint | 5 |

  • procTime returns the cumulative time that the process has used since it started, in ticks (1/60th of a second) .

  • The optional procMode parameter can be a Boolean or longint type variable:

    • If it is a Boolean type, it returns True if the process is visible and False if it is hidden.
    • If it is a longint type, after the method is executed, it contains a bit field where the two first bits are set:
      * bit 0 returns the visibility property: set to 1 if process is visible, and 0 if it is hidden
      * bit 1 returns the preemptive mode property: set to 1 if process runs in preemptive mode, and 0 if it runs in cooperative mode. For more information, please refer to the Preemptive 4D processes section.
  • uniqueID, if specified, returns the unique process number. Actually, each process has attributed a process number to it as well as a unique process number per session. The unique number allows you to differentiate between two processes or two process sessions. It corresponds to the process number having been started during 4D’s session.

  • origin, if specified, returns a value that describes the origin of the process. 4D offers the following predefined constants (in the "Process Type" theme):
ConstantTypeValueComment
Apple event managerLongint-7
Backup processLongint-19
Cache managerLongint-4
Client manager processLongint-31
Compiler processLongint-29
Created from execution dialogLongint3
Created from menu commandLongint2
Design processLongint-2
Event managerLongint-8
Execute on client processLongint-14
Execute on server processLongint1
External taskLongint-9
HTTP Log flusherLongint-58
Indexing processLongint-5
Internal 4D server processLongint-18
Internal timer processLongint-25
Log file processLongint-20
Main 4D processLongint-39
Main processLongint-1
Method editor macro processLongint-17
Monitor processLongint-26
MSC processLongint-22
NoneLongint0
On exit processLongint-16
Other 4D processLongint-10
Other user processLongint4
Restore ProcessLongint-21
Serial Port ManagerLongint-6
Server interface processLongint-15
SOAP processLongint-33
SQL Method execution processLongint-24
Web process on 4D remoteLongint-12
Web process with no contextLongint-3
Web server processLongint-13
Web server spare processLongint-32
Worker processLongint5Worker process launched by user

Note: 4D’s internal processes return a negative value and the processes generated by the user return a positive value.

Example 1

The following example returns the name, state, and time taken in the variables vName, vState, and vTimeSpent for the current process:

 var vName : Text //Initialize the variables
 var vState : Integer
 var vTimeSpent : Integer
 PROCESS PROPERTIES(Current process;vName;vState;vTimeSpent)

Example 2

See example for Semaphore.

Example 3

You want to find out the visibility and execution mode of the current process. You can write:

 var vName : Text
 var vState : Integer
 var vTime : Integer
 var vFlags : Integer
 var isVisible : Boolean
 var isPreemptive : Boolean
 PROCESS PROPERTIES(Current process;vName;vState;vTime;vFlags)
 isVisible:=vFlags?? 0 //true if visible
 isPreemptive:=vFlags?? 1 //true if preemptive

See also

Count tasks
Get process activity
Preemptive 4D processes
Process state