pcntl_getpriority
Description
The pcntl_getpriority of PCNTL for PHP gets the priority of any process.
Syntax
pcntl_getpriority(
?int $process_id = null,
int $mode = PRIO_PROCESS
): int|falseParameters
process_id
If null, the process id of the current process is used.
mode
One of PRIO_PGRP, PRIO_USER, PRIO_PROCESS, PRIO_DARWIN_BG or PRIO_DARWIN_THREAD.
Return
Returns the priority of the process or false on error. A lower numerical value causes more favorable scheduling.
WARNING: This function may return Boolean false, but may also return a non-Boolean value which evaluates to false. Use the === operator for testing the return value of this function.
Examples
1 · void
<?
$return = pcntl_getpriority();
if($return === false)
{
die("pcntl_getpriority");
}
var_export($return);
0
2 · process_id
<?
$process_id = posix_getpid();
$return = pcntl_getpriority($process_id);
if($return === false)
{
die("pcntl_getpriority");
}
var_export($return);
0
3 · mode · PRIO_PGRP
<?
$process_id = posix_getpgrp();
$mode = PRIO_PGRP;
$return = pcntl_getpriority($process_id, $mode);
if($return === false)
{
die("pcntl_getpriority");
}
var_export($return);
0
4 · mode · PRIO_USER
<?
$process_id = posix_getuid();
$mode = PRIO_USER;
$return = pcntl_getpriority($process_id, $mode);
if($return === false)
{
die("pcntl_getpriority");
}
var_export($return);
0
5 · mode · PRIO_PROCESS
<?
$process_id = posix_getpid();
$mode = PRIO_PROCESS;
$return = pcntl_getpriority($process_id, $mode);
if($return === false)
{
die("pcntl_getpriority");
}
var_export($return);
0
Links
Related
PCNTL
- pcntl_alarm
- pcntl_async_signals
- pcntl_errno
- pcntl_exec
- pcntl_fork
- pcntl_get_last_error
- pcntl_rfork
- pcntl_setpriority
- pcntl_signal
- pcntl_signal_dispatch
- pcntl_signal_get_handler
- pcntl_sigprocmask
- pcntl_sigtimedwait
- pcntl_sigwaitinfo
- pcntl_strerror
- pcntl_unshare
- pcntl_wait
- pcntl_waitpid
- pcntl_wexitstatus
- pcntl_wifexited
- pcntl_wifsignaled
- pcntl_wifstopped
- pcntl_wstopsig
- pcntl_wtermsig