mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
Documented new pcntl functions
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@268700 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
174af7013a
commit
efb6b44fd9
4 changed files with 474 additions and 0 deletions
100
reference/pcntl/functions/pcntl-signal-dispatch.xml
Normal file
100
reference/pcntl/functions/pcntl-signal-dispatch.xml
Normal file
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry xml:id="function.pcntl-signal-dispatch" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>pcntl_signal_dispatch</refname>
|
||||
<refpurpose>Calls signal handlers for pending signals</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>pcntl_signal_dispatch</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
The <function>pcntl_signal_dispatch</function> is a replacement for ticks.
|
||||
It calls signal handlers installed by <function>pcntl_signal</function> for
|
||||
each pending signal.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>pcntl_signal_dispatch</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
echo "Installing signal handler...\n";
|
||||
pcntl_signal(SIGHUP, function($signo) {
|
||||
echo "signal handler called\n";
|
||||
});
|
||||
|
||||
echo "Generating signal SIGHUP to self...\n";
|
||||
posix_kill(posix_getpid(), SIGHUP);
|
||||
|
||||
echo "Dispatching...\n";
|
||||
pcntl_signal_dispatch();
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Installing signal handler...
|
||||
Generating signal SIGHUP to self...
|
||||
Dispatching...
|
||||
signal handler called
|
||||
Done
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>pcntl_signal</function></member>
|
||||
<member><function>pcntl_sigprocmask</function></member>
|
||||
<member><function>pcntl_sigwaitinfo</function></member>
|
||||
<member><function>pcntl_sigtimedwait</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:"../../../../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
|
||||
-->
|
121
reference/pcntl/functions/pcntl-sigprocmask.xml
Normal file
121
reference/pcntl/functions/pcntl-sigprocmask.xml
Normal file
|
@ -0,0 +1,121 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry xml:id="function.pcntl-sigprocmask" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>pcntl_sigprocmask</refname>
|
||||
<refpurpose>Sets and retrieves blocked signals</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>pcntl_sigprocmask</methodname>
|
||||
<methodparam><type>int</type><parameter>how</parameter></methodparam>
|
||||
<methodparam><type>array</type><parameter>set</parameter></methodparam>
|
||||
<methodparam choise="opt"><type>array</type><parameter role="reference">oldset</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
The <function>pcntl_sigprocmask</function> function adds, removes or sets blocked
|
||||
signals, depending on the <parameter>how</parameter> parameter.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>how</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Sets the behavior of <function>pcntl_sigprocmask</function>. Possible
|
||||
balues:
|
||||
<simplelist>
|
||||
<member><constant>SIG_BLOCK</constant>: Add the signals to the
|
||||
currently blocked signals.</member>
|
||||
<member><constant>SIG_UNBLOCK</constant>: Remove the signals from the
|
||||
currently blocked signals.</member>
|
||||
<member><constant>SIG_SETMASK</constant>: Replace the currently
|
||||
blocked signals by the given list of signals.</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>set</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
List of signals.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>oldset</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The <parameter>oldset</parameter> parameter is set to an array
|
||||
containing the list of the previously blocked signals.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>pcntl_sigprocmask</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
pcntl_sigprocmask(SIG_BLOCK, array(SIGHUP));
|
||||
$oldset = array();
|
||||
pcntl_sigprocmask(SIG_UNBLOCK, array(SIGHUP), $oldset);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>pcntl_sigwaitinfo</function></member>
|
||||
<member><function>pcntl_sigtimedwait</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:"../../../../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
|
||||
-->
|
107
reference/pcntl/functions/pcntl-sigtimedwait.xml
Normal file
107
reference/pcntl/functions/pcntl-sigtimedwait.xml
Normal file
|
@ -0,0 +1,107 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry xml:id="function.pcntl-sigtimedwait" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>pcntl_sigtimedwait</refname>
|
||||
<refpurpose>Waits for signals, with a timeout</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>pcntl_sigtimedwait</methodname>
|
||||
<methodparam><type>array</type><parameter>set</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>array</type><parameter role="reference">siginfo</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>seconds</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>nanoseconds</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
The <function>pcntl_sigtimedwait</function> function operates in exactly
|
||||
the same way as <function>pcntl_sigwaitinfo</function> except that it takes
|
||||
two additional parameters, <parameter>seconds</parameter> and
|
||||
<parameter>nanoseconds</parameter>, which enable an upper boud to be placed
|
||||
on the time for which the script is suspended.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>set</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Array of signals to wait for.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>siginfo</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The <parameter>siginfo</parameter> is set to an array containing
|
||||
informations about the signal. See
|
||||
<function>pcntl_sigwaitinfo</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>seconds</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Timeout in seconds.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>nanoseconds</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Timeout in nanoseconds.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
On success, <function>pcntl_sigtimedwait</function> returns a signal number.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>pcntl_sigprocmask</function></member>
|
||||
<member><function>pcntl_sigwaitinfo</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:"../../../../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
|
||||
-->
|
146
reference/pcntl/functions/pcntl-sigwaitinfo.xml
Normal file
146
reference/pcntl/functions/pcntl-sigwaitinfo.xml
Normal file
|
@ -0,0 +1,146 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry xml:id="function.pcntl-sigwaitinfo" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>pcntl_sigwaitinfo</refname>
|
||||
<refpurpose>Waits for signals</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>pcntl_sigwaitinfo</methodname>
|
||||
<methodparam><type>array</type><parameter>set</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>array</type><parameter role="reference">siginfo</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
The <function>pcntl_sigwaitinfo</function> function suspends execution of the
|
||||
calling script until one of the signals given in <parameter>set</parameter>
|
||||
are delivered. If one of the signal is already pending (e.g. blocked by
|
||||
<function>pcntl_sigprocmask</function>),
|
||||
<function>pcntl_sigwaitinfo</function> will return immediately.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>set</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Array of signals to wait for.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>siginfo</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The <parameter>siginfo</parameter> is set to an array containing
|
||||
informations about the signal.
|
||||
</para>
|
||||
<para>
|
||||
The following elements are set for all signals:
|
||||
<simplelist>
|
||||
<member>signo: Signal number</member>
|
||||
<member>errno: An error number</member>
|
||||
<member>code: Signal code</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
<para>
|
||||
The following elements may be set for the <constant>SIGCHLD</constant> signal:
|
||||
<simplelist>
|
||||
<member>status: Exit value or signal</member>
|
||||
<member>utime: User time consumed</member>
|
||||
<member>stime: System time consumed</member>
|
||||
<member>pid: Sending process ID</member>
|
||||
<member>uid: Real user ID of sending process</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
<para>
|
||||
The following elements may be set for the <constant>SIGILL</constant>,
|
||||
<constant>SIGFPE</constant>, <constant>SIGSEGV</constant> and
|
||||
<constant>SIGBUS</constant> signals:
|
||||
<simplelist>
|
||||
<member>addr: Memory location which caused fault</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
<para>
|
||||
The following element may be set for the <constant>SIGPOLL</constant>
|
||||
signal:
|
||||
<simplelist>
|
||||
<member>band: Band event</member>
|
||||
<member>fd: File descriptor number</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
On success, <function>pcntl_sigwaitinfo</function> returns a signal number.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>pcntl_sigwaitinfo</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
echo "Blocking SIGHUP signal\n";
|
||||
pcntl_sigprocmask(SIG_BLOCK, array(SIGHUP));
|
||||
|
||||
echo "Sending SIGHUP to self\n";
|
||||
posix_kill(posix_getpid(), SIGHUP);
|
||||
|
||||
echo "Waiting for signals\n";
|
||||
$info = array();
|
||||
pcntl_sigwaitinfo(array(SIGHUP), $info);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>pcntl_sigprocmask</function></member>
|
||||
<member><function>pcntl_sigtimedwait</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:"../../../../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
|
||||
-->
|
Loading…
Reference in a new issue