« Thread
Thread::getCurrentThread »

Thread::getCreatorId

(PECL pthreads >= 2.0.0)

Thread::getCreatorId — 識別

説明

public function Thread::getCreatorId(): int

このスレッドを作ったスレッドの ID を返します。

パラメータ

この関数にはパラメータはありません。

戻り値

数値の ID を返します。

例

例1 このスレッドを作ったスレッドあるいはプロセスの ID を返す

<?php
class My extends Thread {
    public function run() {
        printf("%s created by Thread #%lu\n", __CLASS__, $this->getCreatorId());
    }
}
$my = new My();
$my->start();
?>

上の例の出力は以下となります。

My created by Thread #123456778899
関連キーワード:
Thread   getCreatorId   スレッド   識別   created   getCurrentThread   pthreads   数値   extends   printf   start
関連する関数・ページ:
thread.getthreadid   thread.start   thread.getcurrentthread   thread.join   class.thread   thread.getcurrentthreadid