PHP 8.6.0 Beta 1 is available for testing

Thread::getCurrentThreadId

(PECL pthreads >= 2.0.0)

Thread::getCurrentThreadIdIdentificación

Descripción

public static function Thread::getCurrentThreadId(): int

Se devuelve la identidad del hilo actualmente en ejecución

Parámetros

Esta función no contiene ningún parámetro.

Valores devueltos

Una identidad numérica

Ejemplos

Ejemplo #1 Se devuelve la identidad del hilo actualmente en ejecución

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

El ejemplo anterior mostrará:

My es Hilo #123456778899

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug
+add a note

User Contributed Notes

There are no user contributed notes for this page.

AltStyle によって変換されたページ (->オリジナル) /