pcntl_getpriority

(PHP 5, PHP 7, PHP 8)

pcntl_getpriority — Bir sĂŒrecin önceliğini döndĂŒrĂŒr

Açıklama

function 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 ¶
18 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);
}