php-doc-en/reference/pthreads/stackable/synchronized.xml
Joe Watkins 7b8e8ab429 missing files from pthreads docs
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@328974 c90b9560-bf6c-de11-be94-00142212c4b1
2013-01-04 09:24:39 +00:00

108 lines
2.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="stackable.synchronized" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Stackable::synchronized</refname>
<refpurpose>Synchronization</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier> <modifier>public</modifier> <type>mixed</type><methodname>Stackable::synchronized</methodname>
<methodparam><type>Closure</type><parameter>block</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
</methodsynopsis>
<para>
Executes the block while retaining the synchronization lock for the current context.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>block</parameter></term>
<listitem>
<para>
The block of code to execute
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>...</parameter></term>
<listitem>
<para>
Variable length list of arguments to use as function arguments to the block
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The return value from the block
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Synchronizing</title>
<programlisting role="php">
<![CDATA[
<?php
class My extends Stackable {
public function run() {
$this->synchronized(function($object){
var_dump($object->isWaiting());
$object->notify();
}, $this);
}
}
/** create worker **/
$my = new My();
/** stack my **/
/** execute something here **/
$my->synchronized(function($object){
$object->wait();
}, $my);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(/** true or false **/)
]]>
</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
-->