Documentación offline PHP master

Threaded::notifyOne

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

En esta página

Threaded::notifyOne

Sincronizar

Descripción#

public Threaded::notifyOne(): bool
```php

Envía una notificación al objeto referenciado. Esto desbloquea al menos uno de los threads bloqueados (a diferencia de desbloquearlos todos, como ocurre con Threaded::notify).

## 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

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

```php

El ejemplo anterior mostrará:

bool(true)