Documentación offline PHP master

Threaded::wait

master Ver versión oficial en línea Licencia CC-BY-3.0Descargado el 2026-08-02

En esta página

Threaded::wait

Sincronización

Descripción#

public Threaded::wait([int $timeout]): bool
```php

Hace esperar al contexto llamante una notificación desde el objeto referenciado.

## Parámetros

`timeout`  
Un tiempo de espera máximo opcional, en microsegundos.

## Valores devueltos

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

## Ejemplos

Notificaciones y espera
synchronized(function($thread){ if (!$thread->done) $thread->wait(); }, $this); } } $my = new My(); $my->start(); /** Envía la notificación al hilo que espera **/ $my->synchronized(function($thread){ $thread->done = true; $thread->notify(); }, $my); var_dump($my->join()); ?>

```php

El ejemplo anterior mostrará:

bool(true)