PHP 8.3.4 Released!

Thread::getCreatorId

(PECL pthreads >= 2.0.0)

Thread::getCreatorId識別

説明

public 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

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top