(PECL pthreads >= 2.0.0)
Thread::getCurrentThreadId — 識(shí)別
返回當(dāng)前執(zhí)行線程的ID
此函數(shù)沒(méi)有參數(shù)。
線程ID,數(shù)字格式
示例 #1 返回當(dāng)前執(zhí)行線程的ID
<?php
class My extends Thread {
public function run() {
printf("%s is Thread #%lu\n", __CLASS__, Thread::getCurrentThreadId());
}
}
$my = new My();
$my->start();
?>
以上例程會(huì)輸出:
My is Thread #123456778899