PHP 8.5.0 Alpha 2 available for testing

Thread::isJoined

(PECL pthreads >= 2.0.0)

Thread::isJoinedDetección de estado

Descripción

public Thread::isJoined(): bool

Indica si el Thread referenciado ha sido unido.

Parámetros

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

Valores devueltos

Esta función retorna true en caso de éxito o false si ocurre un error.

Ejemplos

Ejemplo #1 Detecta el estado del Thread referenciado

<?php
class My extends Thread {
public function
run() {
$this->synchronized(function($thread){
if (!
$thread->done)
$this->wait();
},
$this);
}
}
$my = new My();
$my->start();
var_dump($my->isJoined());
$my->synchronized(function($thread){
$thread->done = true;
$thread->notify();
},
$my);
?>

El ejemplo anterior mostrará :

bool(false)

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top