Files
Jim Winstead 0545e305cf Normalize version strings in changelog entries (#3672)
Now they're always N.X.Y for a PHP version, or PECL extension N.X.Y for PECL extensions.
2024-09-23 11:15:26 -07:00

115 lines
2.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="pool.collect" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Pool::collect</refname>
<refpurpose>Collect references to completed tasks</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>int</type><methodname>Pool::collect</methodname>
<methodparam choice="opt"><type>Callable</type><parameter>collector</parameter></methodparam>
</methodsynopsis>
<para>
Allows the pool to collect references determined to be garbage by the
optionally given collector.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>collector</parameter></term>
<listitem>
<para>
A Callable collector that returns a boolean on whether the task can be
collected or not. Only in rare cases should a custom collector need to
be used.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The number of remaining tasks in the pool to be collected.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>PECL pthreads 3.0.0</entry>
<entry>
An integer is now returned, and the <parameter>collector</parameter>
parameter is now optional.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A basic example of <methodname>Pool::collect</methodname></title>
<programlisting role="php">
<![CDATA[
<?php
$pool = new Pool(4);
for ($i = 0; $i < 15; ++$i) {
$pool->submit(new class extends Threaded {});
}
while ($pool->collect()); // blocks until all tasks have finished executing
$pool->shutdown();
]]>
</programlisting>
</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
-->