diff --git a/reference/pthreads/threaded/notifyone.xml b/reference/pthreads/threaded/notifyone.xml new file mode 100644 index 0000000000..44a30f251e --- /dev/null +++ b/reference/pthreads/threaded/notifyone.xml @@ -0,0 +1,93 @@ + + + + + + Threaded::notifyOne + Synchronization + + + + &reftitle.description; + + public booleanThreaded::notifyOne + + + + Send notification to the referenced object. This unblocks at least one of the + blocked threads (as opposed to unblocking all of them, as seen with + Threaded::notify). + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + A boolean indication of success + + + + + &reftitle.examples; + + + Notifications and Waiting + +synchronized(function($thread){ + if (!$thread->done) + $thread->wait(); + }, $this); + } +} +$my = new My(); +$my->start(); +/** send notification to the waiting thread **/ +$my->synchronized(function($thread){ + $thread->done = true; + $thread->notifyOne(); +}, $my); +var_dump($my->join()); +?> +]]> + + &example.outputs; + + + + + + + + + diff --git a/reference/pthreads/versions.xml b/reference/pthreads/versions.xml index ec343c7a4f..0114bff2fb 100644 --- a/reference/pthreads/versions.xml +++ b/reference/pthreads/versions.xml @@ -11,6 +11,7 @@ + @@ -40,6 +41,7 @@ + @@ -75,6 +77,7 @@ +