Files
php-doc-ru/reference/pcntl/functions/pcntl-wait.xml
Alexey Pyltsyn 8f8d4016fe Upd
git-svn-id: https://svn.php.net/repository/phpdoc/ru/trunk@343999 c90b9560-bf6c-de11-be94-00142212c4b1
2018-01-28 09:37:16 +00:00

144 lines
6.3 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: fa994a739c769e155f6b6848f66f1f9a24ec9eb0 Maintainer: rjhdby Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id='function.pcntl-wait' xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>pcntl_wait</refname>
<refpurpose>Ожидает или возвращает статус порожденного дочернего процесса</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>pcntl_wait</methodname>
<methodparam><type>int</type><parameter role="reference">status</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter><initializer>0</initializer></methodparam>
<methodparam choice="opt"><type>array</type><parameter role="reference">rusage</parameter></methodparam>
</methodsynopsis>
<para>
Функция ожидания приостанавливает выполнение текущего процесса до тех пор,
пока дочерний процесс не завершится или пока не будет получен сигнал
который завершает текущий процесс или вызывает функцию обработки сигнала.
Если дочерний процесс уже завершился ко времени вызова
(так называемые "зомби" процессы), функция незамедлительно вернёт управление.
Обратитесь к вашей системному рукодводству (man) wait(2) для уточнения
специфики работы wait в вашей системе.
</para>
<note>
<para>
Эта функция эквивалентна вызову <function>pcntl_waitpid</function>
с аргументом <parameter>pid</parameter> равным <literal>-1</literal> и
без аргумента <parameter>options</parameter>.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>status</parameter></term>
<listitem>
<para>
<function>pcntl_wait</function> разместит информацию о статусе
по ссылке в аргументе <parameter>status</parameter>, который может
быть передан в слудующие функции:
<function>pcntl_wifexited</function>,
<function>pcntl_wifstopped</function>,
<function>pcntl_wifsignaled</function>,
<function>pcntl_wexitstatus</function>,
<function>pcntl_wtermsig</function> и
<function>pcntl_wstopsig</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
Если системный вызов wait3 (man 2 wait3) доступен в вашей системе (как правило в BSD-подобных системах),
вы можете задать необязательный аргумент <parameter>options</parameter>.
Если этот параметр не задан, будет использован стандатный системный вызов wait.
Если системный вызов wait3 не доступен для вашей системы, передача значения
аргумента <parameter>options</parameter> не будет иметь значения.
Значение аргумента <parameter>options</parameter> - это битовая маска,
которая может принимать значение ноль или более путем логического объединения следующих констант:
<table>
<title>Возможные значения для <parameter>options</parameter></title>
<tgroup cols="2">
<tbody>
<row>
<entry><literal>WNOHANG</literal></entry>
<entry>
Незамедлительно вернуть управление, если ни один из дочерних процессов не завершен
</entry>
</row>
<row>
<entry><literal>WUNTRACED</literal></entry>
<entry>
Вернуть управление для остановленных дочерних процессов, о статусе которых ещё не сообщено
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<function>pcntl_wait</function> возвращает ID завершенного дочернего процесса,
-1 при ошибке или ноль, если <literal>WNOHANG</literal> был передан в аргумент
<parameter>options</parameter> (на системах с доступным системным вызовом wait3)
и не было доступных дочерних процессов.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>pcntl_fork</function></member>
<member><function>pcntl_signal</function></member>
<member><function>pcntl_wifexited</function></member>
<member><function>pcntl_wifstopped</function></member>
<member><function>pcntl_wifsignaled</function></member>
<member><function>pcntl_wexitstatus</function></member>
<member><function>pcntl_wtermsig</function></member>
<member><function>pcntl_wstopsig</function></member>
<member><function>pcntl_waitpid</function></member>
</simplelist>
</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
-->