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

search for in the

pcntl_setpriority> <pcntl_fork
Last updated: Fri, 30 Oct 2009

view this page in

pcntl_getpriority

(PHP 5)

pcntl_getpriority Liest die Priorität irgendeines Prozesses

Beschreibung

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

pcntl_getpriority() liest die Priorität von pid . Wenn pid nicht angegeben ist, wird die Pid des aktuellen Prozesses verwendet. Weil die Prioritätsstufen sich zwischen Systemtypen und Kernelversionen unterscheiden können schauen Sie bitte in die getpriority(2) mas Seite Ihres Systems nach spezifischen Details.

pcntl_getpriority() gibt die Priorität des Prozesses oder FALSE im Fehlerfall zurück. Ein kleinerer numerischer Wert ruft günstigeres Scheduling hervor.

process_identifier ist einer der Werte PRIO_PGRP, PRIO_USER, oder PRIO_PROCESS.

Warnung

Diese Funktion kann sowohl das boolsche FALSE zurückliefern, als auch einen nicht-boolschen Wert, wie zum Beispiel 0 oder "", der von einem einfachen if-Statement als FALSE ausgewertet wird. Weitere Informationen entnehmen Sie bitte dem Abschnitt über die boolschen Typen. Benutzen Sie deshalb den === Operator, um den Rückgabewert dieser Funktion zu überprüfen.



add a note add a note User Contributed Notes
pcntl_getpriority
jonathan at jcdesigns dot com
15-May-2008 11: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, 30 Oct 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites