mirror of
https://github.com/php/doc-pt_br.git
synced 2026-03-24 07:02:09 +01:00
114 lines
3.4 KiB
XML
114 lines
3.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 658c808b558cab3ab64cc86f55cc9056aa7818e6 Maintainer: leonardolara Status: ready -->
|
|
|
|
<refentry xml:id="function.sapi-windows-generate-ctrl-event" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>sapi_windows_generate_ctrl_event</refname>
|
|
<refpurpose>Envia um evento CTRL a outro processo</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>sapi_windows_generate_ctrl_event</methodname>
|
|
<methodparam><type>int</type><parameter>event</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>pid</parameter><initializer>0</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Envia um evento CTRL a outro processo no mesmo grupo de processos.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>event</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
O evento <literal>CTRL</literal> a enviar;
|
|
pode ser <constant>PHP_WINDOWS_EVENT_CTRL_C</constant>
|
|
ou <constant>PHP_WINDOWS_EVENT_CTRL_BREAK</constant>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>pid</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
O ID do processo ao qual deve-se enviar o evento. Se <literal>0</literal>
|
|
for informado, o evento é enviado a todos os processos do mesmo grupo.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.success;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example xml:id="sapi-windows-generate-ctrl-event.example.basic">
|
|
<title>Uso Básico de <function>sapi_windows_generate_ctrl_event</function></title>
|
|
<para>
|
|
Este exemplo mostra como passar eventos <literal>CTRL+BREAK</literal> para um processo
|
|
filho. Neste caso, o processo filho mostra <literal>Ainda estou vivo</literal>
|
|
a cada segundo, até que o usuário pressione <literal>CTRL+BREAK</literal>, o que faz com
|
|
que apenas o processo filho seja terminado.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// envia eventos CTRL+BREAK para o processo filho
|
|
sapi_windows_set_ctrl_handler('sapi_windows_generate_ctrl_event');
|
|
|
|
// cria um processo filho que mostra uma mensagem a cada segundo
|
|
$cmd = ['php', '-r', 'while (true) { echo "Ainda estou vivo\n"; sleep(1); }'];
|
|
$descspec = array(['pipe', 'r'], ['pipe', 'w'], ['pipe', 'w']);
|
|
$options = ['create_process_group' => true];
|
|
$proc = proc_open($cmd, $descspec, $pipes, null, null, $options);
|
|
while (true) {
|
|
echo fgets($pipes[1]);
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<simplelist>
|
|
<member><function>proc_open</function></member>
|
|
<member><function>sapi_windows_set_ctrl_handler</function></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
|
|
-->
|