note 83201 added to function.pcntl-getpriority
| From: | jonathan at jcdesigns dot com | Date: | Thu, 15 May 2008 09:12:47 +0000 |
| Subject: | note 83201 added to function.pcntl-getpriority | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139399@lists.php.net to get a copy of this message | ||
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);
}
----
Server IP: 87.124.64.96
Probable Submitter: 80.177.197.163
----
Manual Page -- http://www.php.net/manual/en/function.pcntl-getpriority.php
Edit -- https://master.php.net/note/edit/83201
Del: integrated -- https://master.php.net/note/delete/83201/integrated
Del: useless -- https://master.php.net/note/delete/83201/useless
Del: bad code -- https://master.php.net/note/delete/83201/bad+code
Del: spam -- https://master.php.net/note/delete/83201/spam
Del: non-english -- https://master.php.net/note/delete/83201/non-english
Del: in docs -- https://master.php.net/note/delete/83201/in+docs
Del: other reasons-- https://master.php.net/note/delete/83201
Reject -- https://master.php.net/note/reject/83201
Search -- https://master.php.net/manage/user-notes.php