Thread::getThreadId
(PECL pthreads >= 2.0.0)
Thread::getThreadId — 識別
説明
public Thread::getThreadId
( void
) : integer
このスレッドの ID を返します。
パラメータ
この関数にはパラメータはありません。
返り値
数値の ID を返します。
例
例1 このスレッドの ID を返す
<?php
class My extends Thread {
public function run() {
printf("%s is Thread #%lu\n", __CLASS__, $this->getThreadId());
}
}
$my = new My();
$my->start();
?>
上の例の出力は以下となります。
My is Thread #123456778899