PHP 8.3.4 Released!

pcntl_getpriority

(PHP 5, PHP 7, PHP 8)

pcntl_getpriorityBir sürecin önceliğini döndürür

Açıklama

pcntl_getpriority(?int $pid = null, int $süreç_türü = PRIO_PROCESS): int|false

Süreç kimliği pid ile belirtilen sürecin öncelik seviyesini döndürür. Öncelik seviyeleri sistem türüne ve çekirdeğe göre farklılık gösterdiğinden ayrıntılı bilgi için sisteminizdeki setpriority(2) kılavuz sayfasına bakınız.

Bağımsız Değişkenler

pid

null aktarılırsa işlevi çağıran sürecin süreç kimliği kullanılır.

süreç_türü

PRIO_PGRP, PRIO_USER, PRIO_PROCESS, PRIO_DARWIN_BG ve PRIO_DARWIN_THREAD sabitlerinden biri.

Dönen Değerler

Hata durumunda false yoksa belirtilen sürecin öncelik seviyesini döndürür. Düşük sayısal değerler daha yüksek öncelik sağlar.

Uyarı

Bu işlev mantıksal false değeriyle dönebileceği gibi false olarak değerlendirilebilecek mantıksal olmayan bir değerle de dönebilir. Bu konuda daha fazla bilgi Mantıksal Değerler bölümünde bulunabilir. Bu işlevden dönen değeri sınamak için === işleci kullanılabilir.

Sürüm Bilgisi

Sürüm: Açıklama
8.0.0 pid artık null olabiliyor.

Ayrıca Bakınız

add a note

User Contributed Notes 1 note

up
2
jonathan at jcdesigns dot com
15 years ago
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);
}
To Top