PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

pcntl_setpriority> <pcntl_fork
Last updated: Fri, 25 Jul 2008

view this page in

pcntl_getpriority

(PHP 5)

pcntl_getpriorityプロセスの優先度を取得する

説明

int pcntl_getpriority ([ int $pid [, int $process_identifier ]] )

pcntl_getpriority() は、pid の優先度を設定します。システムの型やカーネルの バージョンによって優先度の扱いは違うので、詳細についてはシステムの getpriority(2) の man ページを参照ください。

パラメータ

pid

指定しなかった場合は、現在のプロセスの PID を使用します。

process_identifier

PRIO_PGRPPRIO_USER あるいは PRIO_PROCESS のいずれか。

返り値

pcntl_getpriority() はプロセスの優先度を返します。 エラー時には FALSE を返します。数字が小さいほど、優先順位は上となります。

警告

この関数は論理値 FALSE を返す可能性がありますが、FALSE として評価される 0 や "" といった値を返す可能性もあります。 詳細については 論理値の セクションを参照してください。この関数の返り値を調べるには ===演算子 を 使用してください。



add a note add a note User Contributed Notes
pcntl_getpriority
jonathan at jcdesigns dot com
15-May-2008 02:12
This function is ideal for checking if a given process is running, I have seen solutions that involve running the system utilites like PS and parsing the answer, which should work fine, but this allows you to check a given PID with a single call

function CheckPID( $PID )
{
        // Check if the passed in PID represents a vlaid process in the system
        // Returns true if it does
        // Turn off non-fatal runtime warning for a moment as we know we
        // will get one if the PID does not represent a valid process
 
    $oldErrorLevel = error_reporting(0);
    error_reporting( $oldErrorLevel & ~E_WARNING );
    $res = pcntl_getpriority($PID);
    error_reporting( $oldErrorLevel);
    return ! ( $res === false);
}

pcntl_setpriority> <pcntl_fork
Last updated: Fri, 25 Jul 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites