Php/docs/thread.getthreadid

提供:Dev Guides
< Php
移動先:案内検索

Thread::getThreadId

(PECL pthreads >= 2.0.0)

Thread::getThreadId識別


説明

public Thread::getThreadId ( ) : int

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


パラメータ

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


返り値

数値の ID を返します。


例1 このスレッドの ID を返す

<?phpclass My extends Thread {    public function run() {        printf("%s is Thread #%lu\n", __CLASS__, $this->getThreadId());    }}$my = new My();$my->start();?>

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


My is Thread #123456778899