Thread::getCurrentThreadId

(PECL pthreads >= 2.0.0)

Thread::getCurrentThreadIdIdentification

Descripción

publicstaticThread::getCurrentThreadId(): int

Will return the identity of the currently executing Thread

Parámetros

Esta función no tiene parámetros.

Valores devueltos

A numeric identity

Ejemplos

Ejemplo #1 Return the identity of the currently executing Thread

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

El resultado del ejemplo sería:

My is Thread #123456778899
To Top