(PECL pthreads >= 2.0.0)
Thread::getCreatorId — 識(shí)別
返回創(chuàng)建當(dāng)前線程的線程ID。
此函數(shù)沒有參數(shù)。
線程ID,數(shù)字格式
示例 #1 返回創(chuàng)建線程的線程或進(jìn)程ID
<?php
class My extends Thread {
public function run() {
printf("%s created by Thread #%lu\n", __CLASS__, $this->getCreatorId());
}
}
$my = new My();
$my->start();
?>
以上例程會(huì)輸出:
My created by Thread #123456778899