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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision$ --> + +<refentry xml:id="threaded.notifyone" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>Threaded::notifyOne</refname> + <refpurpose>Synchronization</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <modifier>public</modifier> <type>boolean</type><methodname>Threaded::notifyOne</methodname> + <void /> + </methodsynopsis> + <para> + 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 + <methodname>Threaded::notify</methodname>). + </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + &no.function.parameters; + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + A boolean indication of success + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Notifications and Waiting</title> + <programlisting role="php"> +<![CDATA[ +<?php +class My extends Thread { + public function run() { + /** cause this thread to wait **/ + $this->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()); +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +bool(true) +]]> + </screen> + </example> + </para> + </refsect1> +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> 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 @@ <function name='threaded::run' from='PECL pthreads >= 2.0.0'/> <function name='threaded::wait' from='PECL pthreads >= 2.0.0'/> <function name='threaded::notify' from='PECL pthreads >= 2.0.0'/> + <function name='threaded::notifyone' from='PECL pthreads >= 3.0.0'/> <function name='threaded::isrunning' from='PECL pthreads >= 2.0.0'/> <function name='threaded::iswaiting' from='PECL pthreads < 3.0.0'/> <function name='threaded::isterminated' from='PECL pthreads >= 2.0.0'/> @@ -40,6 +41,7 @@ <function name='thread::run' from='PECL pthreads >= 2.0.0'/> <function name='thread::wait' from='PECL pthreads >= 2.0.0'/> <function name='thread::notify' from='PECL pthreads >= 2.0.0'/> + <function name='threaded::notifyone' from='PECL pthreads >= 3.0.0'/> <function name='thread::isrunning' from='PECL pthreads >= 2.0.0'/> <function name='thread::iswaiting' from='PECL pthreads < 3.0.0'/> <function name='thread::isterminated' from='PECL pthreads >= 2.0.0'/> @@ -75,6 +77,7 @@ <function name='worker::run' from='PECL pthreads >= 2.0.0'/> <function name='worker::wait' from='PECL pthreads >= 2.0.0'/> <function name='worker::notify' from='PECL pthreads >= 2.0.0'/> + <function name='threaded::notifyone' from='PECL pthreads >= 3.0.0'/> <function name='worker::isrunning' from='PECL pthreads >= 2.0.0'/> <function name='worker::iswaiting' from='PECL pthreads < 3.0.0'/> <function name='worker::isterminated' from='PECL pthreads >= 2.0.0'/>