Thread::getThreadId() returns 0 if the thread has not been started.
(PECL pthreads >= 2.0.0)
Thread::getThreadId — Identificación
Esta función no tiene parámetros.
Una identidad numérica.
Ejemplo #1 Se devuelve la identidad del Thread referenciado
<?php
class My extends Thread {
public function run() {
printf("%s es el Thread #%lu\n", __CLASS__, $this->getThreadId());
}
}
$my = new My();
$my->start();
?>
El resultado del ejemplo sería:
My es el Thread #123456778899
Thread::getThreadId() returns 0 if the thread has not been started.