Added PECL sync extension documentation.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@334136 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Thomas Hruska 2014-07-06 02:42:55 +00:00
parent cd1472667a
commit 8690c4193b
25 changed files with 2015 additions and 0 deletions

65
reference/sync/book.xml Normal file
View file

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<book xml:id="book.sync" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Sync</title>
<titleabbrev>Sync</titleabbrev>
<preface xml:id="intro.sync">
&reftitle.intro;
<para>
The 'sync' extension introduces cross-platform synchonization objects into PHP.
Named and unnamed Mutex, Semaphore, Event, and Reader-Writer objects provide
OS-level synchronization on both POSIX (e.g. Linux) and Windows platforms.
</para>
<para>
Automatic cleanup of acquired synchronization objects takes place during extension
teardown. This means that if PHP prematurely terminates a script (e.g. script
execution time is exceeded), objects will not be left in an unknown state. The
only exception to this is if PHP itself crashes (e.g. an internal buffer overflow).
</para>
<para>
Unnamed synchronization objects don't have a lot of use outside of a multithreaded
scenario. Unnamed objects are more useful in conjunction with the pthreads PECL
extension.
</para>
<note>
<para>
Named objects require additional care to be used on all systems.
If an object is instantiated with a specific set of parameters, it must always
be instantiated with those parameters or the object will probably end up in an
inconsistent state until the next reboot or a system administrator cleans up
the mess.
</para>
</note>
</preface>
&reference.sync.setup;
&reference.sync.constants;
&reference.sync.syncmutex;
&reference.sync.syncsemaphore;
&reference.sync.syncevent;
&reference.sync.syncreaderwriter;
</book>
<!-- 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
-->

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<section xml:id="sync.installation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.install;
<para>
&pecl.info;
<link xlink:href="&url.pecl.package;sync">&url.pecl.package;sync</link>
</para>
</section>
<!-- 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
-->

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<appendix xml:id="sync.constants" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.constants;
&no.constants;
</appendix>
<!-- 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
-->

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<reference xml:id="ref.sync" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Sync &Functions;</title>
&reference.sync.entities.functions;
</reference>
<!-- 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
-->

53
reference/sync/setup.xml Normal file
View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="sync.setup" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.setup;
<section xml:id="sync.requirements">
&reftitle.required;
<para>
A system with support for POSIX semaphores (sem_open()) or running Windows.
</para>
</section>
<section xml:id="sync.installation">
&reftitle.install;
<para>
&pecl.info;
<link xlink:href="&url.pecl.package;sync">&url.pecl.package;sync</link>.
</para>
</section>
<section xml:id="sync.configuration">
&reftitle.runtime;
&no.config;
</section>
<section xml:id="sync.resources">
&reftitle.resources;
&no.resource;
</section>
</chapter>
<!-- 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
-->

View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.syncevent" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The SyncEvent class</title>
<titleabbrev>SyncEvent</titleabbrev>
<partintro>
<!-- {{{ SyncEvent intro -->
<section xml:id="syncevent.intro">
&reftitle.intro;
<para>
A cross-platform, native implementation of named and unnamed event objects. Both automatic and manual event objects are supported.
</para>
<para>
An event object waits, without polling, for the object to be fired/set.
One instance waits on the event object while another instance fires/sets
the event. Event objects are useful wherever a long-running process would
otherwise poll a resource (e.g. checking to see if uploaded data needs to
be processed).
</para>
</section>
<!-- }}} -->
<section xml:id="syncevent.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>SyncEvent</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>SyncEvent</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.syncevent')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[not(@role='procedural')])" />
</classsynopsis>
<!-- }}} -->
</section>
</partintro>
&reference.sync.entities.syncevent;
</phpdoc:classref>
<!-- 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
-->

View file

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="syncevent.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SyncEvent::__construct</refname>
<refpurpose>Description</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <methodname>SyncEvent::__construct</methodname>
<methodparam choice="opt"><type>string</type><parameter>name</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>manual</parameter></methodparam>
</methodsynopsis>
<para>
Constructs a named or unnamed event object.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>
The name of the event if this is a named event object.
</para>
<note>
<para>
If the name already exists, it must be able to be opened by the current user
that the process is running as or an exception will be thrown with a meaningless
error message.
</para>
</note>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>manual</parameter></term>
<listitem>
<para>
Specifies whether or not the event object must be reset manually.
</para>
<note>
<para>
Manual reset event objects allow all waiting processes through until the
object is reset.
</para>
</note>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The new SyncEvent object. An exception is thrown if the event object cannot
be created or opened.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>SyncEvent::__construct</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// In a web application:
$event = new SyncEvent("GetAppReport");
$event->fire();
// In a cron job:
$event = new SyncEvent("GetAppReport");
$event->wait();
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>SyncEvent::fire</methodname></member>
<member><methodname>SyncEvent::reset</methodname></member>
<member><methodname>SyncEvent::wait</methodname></member>
</simplelist>
</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
-->

View file

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="syncevent.fire" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SyncEvent::fire</refname>
<refpurpose>Description</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>ReturnType</type><methodname>SyncEvent::fire</methodname>
<void />
</methodsynopsis>
<para>
Fires/sets a SyncEvent object. Lets multiple threads through that are waiting
if the event object was created with a manual value of TRUE.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A boolean of TRUE if the event was fired, FALSE otherwise.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>SyncEvent::fire</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// In a web application:
$event = new SyncEvent("GetAppReport");
$event->fire();
// In a cron job:
$event = new SyncEvent("GetAppReport");
$event->wait();
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>SyncEvent::reset</methodname></member>
<member><methodname>SyncEvent::wait</methodname></member>
</simplelist>
</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
-->

View file

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="syncevent.reset" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SyncEvent::reset</refname>
<refpurpose>Description</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>ReturnType</type><methodname>SyncEvent::reset</methodname>
<void />
</methodsynopsis>
<para>
Resets a SyncEvent object that has been fired/set. Only valid for manual event objects.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A boolean value of TRUE if the object was successfully reset, FALSE otherwise.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>SyncEvent::reset</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// In a web application:
$event = new SyncEvent("DemoApplication", true);
$event->wait();
// In a cron job:
$event = new SyncEvent("DemoApplication", true);
$event->reset();
/* ... Do some maintenance task(s) ... */
$event->fire();
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>SyncEvent::fire</methodname></member>
<member><methodname>SyncEvent::reset</methodname></member>
<member><methodname>SyncEvent::wait</methodname></member>
</simplelist>
</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
-->

View file

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="syncevent.wait" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SyncEvent::wait</refname>
<refpurpose>Description</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>ReturnType</type><methodname>SyncEvent::wait</methodname>
<methodparam choice="opt"><type>integer</type><parameter>wait</parameter></methodparam>
</methodsynopsis>
<para>
Waits for the SyncEvent object to be fired.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>wait</parameter></term>
<listitem>
<para>
The number of milliseconds to wait for the event to be fired.
A value of -1 is infinite.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A boolean of TRUE if the event was fired, FALSE otherwise.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>SyncEvent::wait</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// In a web application:
$event = new SyncEvent("GetAppReport");
$event->fire();
// In a cron job:
$event = new SyncEvent("GetAppReport");
$event->wait();
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>SyncEvent::fire</methodname></member>
</simplelist>
</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
-->

View file

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.syncmutex" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The SyncMutex class</title>
<titleabbrev>SyncMutex</titleabbrev>
<partintro>
<!-- {{{ SyncMutex intro -->
<section xml:id="syncmutex.intro">
&reftitle.intro;
<para>
A cross-platform, native implementation of named and unnamed countable mutex objects.
</para>
<para>
A mutex is a mutual exclusion object that restricts access to a shared resource (e.g. a file) to a single instance.
Countable mutexes acquire the mutex a single time and internally track the number of times the mutex is locked.
The mutex is unlocked as soon as it goes out of scope or is unlocked the same number of times that it was locked.
</para>
</section>
<!-- }}} -->
<section xml:id="syncmutex.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>SyncMutex</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>SyncMutex</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.syncmutex')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[not(@role='procedural')])" />
</classsynopsis>
<!-- }}} -->
</section>
</partintro>
&reference.sync.entities.syncmutex;
</phpdoc:classref>
<!-- 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
-->

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="syncmutex.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SyncMutex::__construct</refname>
<refpurpose>Description</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <methodname>SyncMutex::__construct</methodname>
<methodparam choice="opt"><type>string</type><parameter>name</parameter></methodparam>
</methodsynopsis>
<para>
Constructs a named or unnamed countable mutex.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>
The name of the mutex if this is a named mutex object.
</para>
<note>
<para>
If the name already exists, it must be able to be opened by the current user
that the process is running as or an exception will be thrown with a meaningless
error message.
</para>
</note>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The new SyncMutex object. An exception is thrown if the mutex cannot be
created or opened.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>SyncMutex::__construct</function> named mutex with lock timeout example</title>
<programlisting role="php">
<![CDATA[
<?php
$mutex = new SyncMutex("UniqueName");
if (!$mutex->lock(3000))
{
echo "Unable to lock mutex.";
exit();
}
/* ... */
$mutex->unlock();
?>
]]>
</programlisting>
</example>
<example>
<title><function>SyncMutex::__construct</function> unnamed mutex example</title>
<programlisting role="php">
<![CDATA[
<?php
$mutex = new SyncMutex();
$mutex->lock();
/* ... */
$mutex->unlock();
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>SyncMutex::lock</methodname></member>
<member><methodname>SyncMutex::unlock</methodname></member>
</simplelist>
</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
-->

View file

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="syncmutex.lock" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SyncMutex::lock</refname>
<refpurpose>Description</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>ReturnType</type><methodname>SyncMutex::lock</methodname>
<methodparam choice="opt"><type>integer</type><parameter>wait</parameter></methodparam>
</methodsynopsis>
<para>
Obtains an exclusive lock on a SyncMutex object.
If the lock is already acquired, then this increments an internal counter.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>wait</parameter></term>
<listitem>
<para>
The number of milliseconds to wait for the exclusive lock.
A value of -1 is infinite.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A boolean of TRUE if the lock was obtained, FALSE otherwise.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>SyncMutex::lock</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$mutex = new SyncMutex("UniqueName");
if (!$mutex->lock(3000))
{
echo "Unable to lock mutex.";
exit();
}
/* ... */
$mutex->unlock();
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>SyncMutex::unlock</methodname></member>
</simplelist>
</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
-->

View file

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="syncmutex.unlock" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SyncMutex::unlock</refname>
<refpurpose>Description</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>ReturnType</type><methodname>SyncMutex::unlock</methodname>
<methodparam choice="opt"><type>bool</type><parameter>all</parameter></methodparam>
</methodsynopsis>
<para>
Decreases the internal counter of a SyncMutex object.
When the internal counter reaches zero, the actual lock on the object is released.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>all</parameter></term>
<listitem>
<para>
Specifies whether or not to set the internal counter to zero and therefore release the lock.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A boolean of TRUE if the unlock operation was successful, FALSE otherwise.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>SyncMutex::unlock</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$mutex = new SyncMutex("UniqueName");
$mutex->lock();
/* ... */
$mutex->unlock();
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>SyncMutex::lock</methodname></member>
</simplelist>
</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
-->

View file

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.syncreaderwriter" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The SyncReaderWriter class</title>
<titleabbrev>SyncReaderWriter</titleabbrev>
<partintro>
<!-- {{{ SyncReaderWriter intro -->
<section xml:id="syncreaderwriter.intro">
&reftitle.intro;
<para>
A cross-platform, native implementation of named and unnamed reader-writer objects.
</para>
<para>
A reader-writer object allows many readers or one writer to access a resource.
This is an efficient solution for managing resources where access will primarily be
read-only but exclusive write access is occasionally necessary.
</para>
</section>
<!-- }}} -->
<section xml:id="syncreaderwriter.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>SyncReaderWriter</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>SyncReaderWriter</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.syncreaderwriter')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[not(@role='procedural')])" />
</classsynopsis>
<!-- }}} -->
</section>
</partintro>
&reference.sync.entities.syncreaderwriter;
</phpdoc:classref>
<!-- 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
-->

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="syncreaderwriter.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SyncReaderWriter::__construct</refname>
<refpurpose>Description</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <methodname>SyncReaderWriter::__construct</methodname>
<methodparam choice="opt"><type>string</type><parameter>name</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>autounlock</parameter></methodparam>
</methodsynopsis>
<para>
Constructs a named or unnamed reader-writer object.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>
The name of the reader-writer if this is a named reader-writer object.
</para>
<note>
<para>
If the name already exists, it must be able to be opened by the current user
that the process is running as or an exception will be thrown with a meaningless
error message.
</para>
</note>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>autounlock</parameter></term>
<listitem>
<para>
Specifies whether or not to automatically unlock the reader-writer at the
conclusion of the PHP script.
</para>
<warning>
<para>
If an object is: A named reader-writer with an autounlock of FALSE, the
object is locked for either reading or writing, and the PHP script concludes
before the object is unlocked, then the underlying objects will end up in an
inconsistent state.
</para>
</warning>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The new SyncReaderWriter object. An exception is thrown if the reader-writer
cannot be created or opened.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>SyncReaderWriter::__construct</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$readwrite = new SyncReaderWriter("FileCacheLock");
$readwrite->readlock();
/* ... */
$readwrite->readunlock();
$readwrite->writelock();
/* ... */
$readwrite->writeunlock();
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>SyncReaderWriter::readlock</methodname></member>
<member><methodname>SyncReaderWriter::readunlock</methodname></member>
<member><methodname>SyncReaderWriter::writelock</methodname></member>
<member><methodname>SyncReaderWriter::writeunlock</methodname></member>
</simplelist>
</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
-->

View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="syncreaderwriter.readlock" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SyncReaderWriter::readlock</refname>
<refpurpose>Description</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>ReturnType</type><methodname>SyncReaderWriter::readlock</methodname>
<methodparam choice="opt"><type>integer</type><parameter>wait</parameter></methodparam>
</methodsynopsis>
<para>
Obtains a read lock on a SyncReaderWriter object.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>wait</parameter></term>
<listitem>
<para>
The number of milliseconds to wait for a lock.
A value of -1 is infinite.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A boolean of TRUE if the lock was obtained, FALSE otherwise.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>SyncReaderWriter::readlock</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$readwrite = new SyncReaderWriter("FileCacheLock");
$readwrite->readlock();
/* ... */
$readwrite->readunlock();
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>SyncReaderWriter::readunlock</methodname></member>
</simplelist>
</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
-->

View file

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="syncreaderwriter.readunlock" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SyncReaderWriter::readunlock</refname>
<refpurpose>Description</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>ReturnType</type><methodname>SyncReaderWriter::readunlock</methodname>
<void />
</methodsynopsis>
<para>
Releases a read lock on a SyncReaderWriter object.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A boolean of TRUE if the unlock operation was successful, FALSE otherwise.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>SyncReaderWriter::readunlock</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$readwrite = new SyncReaderWriter("FileCacheLock");
$readwrite->readlock();
/* ... */
$readwrite->readunlock();
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>SyncReaderWriter::readlock</methodname></member>
</simplelist>
</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
-->

View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="syncreaderwriter.writelock" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SyncReaderWriter::writelock</refname>
<refpurpose>Description</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>ReturnType</type><methodname>SyncReaderWriter::writelock</methodname>
<methodparam choice="opt"><type>integer</type><parameter>wait</parameter></methodparam>
</methodsynopsis>
<para>
Obtains an exclusive write lock on a SyncReaderWriter object.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>wait</parameter></term>
<listitem>
<para>
The number of milliseconds to wait for a lock.
A value of -1 is infinite.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A boolean of TRUE if the lock was obtained, FALSE otherwise.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>SyncReaderWriter::writelock</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$readwrite = new SyncReaderWriter("FileCacheLock");
$readwrite->writelock();
/* ... */
$readwrite->writeunlock();
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>SyncReaderWriter::writeunlock</methodname></member>
</simplelist>
</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
-->

View file

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="syncreaderwriter.writeunlock" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SyncReaderWriter::writeunlock</refname>
<refpurpose>Description</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>ReturnType</type><methodname>SyncReaderWriter::writeunlock</methodname>
<void />
</methodsynopsis>
<para>
Releases a write lock on a SyncReaderWriter object.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A boolean of TRUE if the unlock operation was successful, FALSE otherwise.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>SyncReaderWriter::writeunlock</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$readwrite = new SyncReaderWriter("FileCacheLock");
$readwrite->writelock();
/* ... */
$readwrite->writeunlock();
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>SyncReaderWriter::writelock</methodname></member>
</simplelist>
</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
-->

View file

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.syncsemaphore" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The SyncSemaphore class</title>
<titleabbrev>SyncSemaphore</titleabbrev>
<partintro>
<!-- {{{ SyncSemaphore intro -->
<section xml:id="syncsemaphore.intro">
&reftitle.intro;
<para>
A cross-platform, native implementation of named and unnamed sempahore objects.
</para>
<para>
A semaphore restricts access to a limited resource to a limited number of instances.
Semaphores differ from mutexes in that they can allow more than one instance to
access a resource at one time while a mutex only allows one instance at a time.
</para>
</section>
<!-- }}} -->
<section xml:id="syncsemaphore.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>SyncSemaphore</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>SyncSemaphore</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.syncsemaphore')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[not(@role='procedural')])" />
</classsynopsis>
<!-- }}} -->
</section>
</partintro>
&reference.sync.entities.syncsemaphore;
</phpdoc:classref>
<!-- 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
-->

View file

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="syncsemaphore.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SyncSemaphore::__construct</refname>
<refpurpose>Description</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <methodname>SyncSemaphore::__construct</methodname>
<methodparam choice="opt"><type>string</type><parameter>name</parameter></methodparam>
<methodparam choice="opt"><type>integer</type><parameter>initialval</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>autounlock</parameter></methodparam>
</methodsynopsis>
<para>
Constructs a named or unnamed semaphore.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>
The name of the semaphore if this is a named semaphore object.
</para>
<note>
<para>
If the name already exists, it must be able to be opened by the current user
that the process is running as or an exception will be thrown with a meaningless
error message.
</para>
</note>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>initialval</parameter></term>
<listitem>
<para>
The initial value of the semaphore. This is the number of locks that may be obtained.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>autounlock</parameter></term>
<listitem>
<para>
Specifies whether or not to automatically unlock the semaphore at the
conclusion of the PHP script.
</para>
<warning>
<para>
If an object is: A named semaphore with an autounlock of FALSE, the object is
locked, and the PHP script concludes before the object is unlocked, then the
underlying semaphore will end up in an inconsistent state.
</para>
</warning>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The new SyncSemaphore object. An exception is thrown if the semaphore cannot
be created or opened.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>SyncSemaphore::__construct</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$semaphore = new SyncSemaphore("LimitedResource_2clients", 2);
if (!$semaphore->lock(3000))
{
echo "Unable to lock semaphore.";
exit();
}
/* ... */
$semaphore->unlock();
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>SyncSemaphore::lock</methodname></member>
<member><methodname>SyncSemaphore::unlock</methodname></member>
</simplelist>
</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
-->

View file

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="syncsemaphore.lock" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SyncSemaphore::lock</refname>
<refpurpose>Description</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>ReturnType</type><methodname>SyncSemaphore::lock</methodname>
<methodparam choice="opt"><type>integer</type><parameter>wait</parameter></methodparam>
</methodsynopsis>
<para>
Decreases the count of a SyncSemaphore object or waits until the semaphore becomes non-zero.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>wait</parameter></term>
<listitem>
<para>
The number of milliseconds to wait for the semaphore.
A value of -1 is infinite.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A boolean of TRUE if the lock operation was successful, FALSE otherwise.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>SyncSemaphore::lock</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$semaphore = new SyncSemaphore("LimitedResource_2clients", 2);
if (!$semaphore->lock(3000))
{
echo "Unable to lock semaphore.";
exit();
}
/* ... */
$semaphore->unlock();
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>SyncSemaphore::unlock</methodname></member>
</simplelist>
</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
-->

View file

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="syncsemaphore.unlock" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SyncSemaphore::unlock</refname>
<refpurpose>Description</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>ReturnType</type><methodname>SyncSemaphore::unlock</methodname>
<methodparam choice="opt"><type>integer</type><parameter role="reference">prevcount</parameter></methodparam>
</methodsynopsis>
<para>
Increases the count of a SyncSemaphore object.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>prevcount</parameter></term>
<listitem>
<para>
Returns the previous count of the semaphore.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A boolean of TRUE if the unlock operation was successful, FALSE otherwise.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>SyncSemaphore::unlock</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$semaphore = new SyncSemaphore("LimitedResource_2clients", 2);
if (!$semaphore->lock(3000))
{
echo "Unable to lock semaphore.";
exit();
}
/* ... */
$semaphore->unlock();
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>SyncSemaphore::lock</methodname></member>
</simplelist>
</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
-->

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!--
Do NOT translate this file
-->
<versions>
<!-- Classes and Methods -->
<function name='syncmutex' from='PECL sync &gt;= 1.0.0'/>
<function name='syncmutex::__construct' from='PECL sync &gt;= 1.0.0'/>
<function name='syncmutex::lock' from='PECL sync &gt;= 1.0.0'/>
<function name='syncmutex::unlock' from='PECL sync &gt;= 1.0.0'/>
<function name='syncsemaphore' from='PECL sync &gt;= 1.0.0'/>
<function name='syncsemaphore::__construct' from='PECL sync &gt;= 1.0.0'/>
<function name='syncsemaphore::lock' from='PECL sync &gt;= 1.0.0'/>
<function name='syncsemaphore::unlock' from='PECL sync &gt;= 1.0.0'/>
<function name='syncevent' from='PECL sync &gt;= Unknown'/>
<function name='syncevent::__construct' from='PECL sync &gt;= 1.0.0'/>
<function name='syncevent::wait' from='PECL sync &gt;= 1.0.0'/>
<function name='syncevent::fire' from='PECL sync &gt;= 1.0.0'/>
<function name='syncevent::reset' from='PECL sync &gt;= 1.0.0'/>
<function name='syncreaderwriter' from='PECL sync &gt;= 1.0.0'/>
<function name='syncreaderwriter::__construct' from='PECL sync &gt;= 1.0.0'/>
<function name='syncreaderwriter::readlock' from='PECL sync &gt;= 1.0.0'/>
<function name='syncreaderwriter::writelock' from='PECL sync &gt;= 1.0.0'/>
<function name='syncreaderwriter::readunlock' from='PECL sync &gt;= 1.0.0'/>
<function name='syncreaderwriter::writeunlock' from='PECL sync &gt;= 1.0.0'/>
</versions>
<!-- 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
-->