mirror of
https://github.com/php/doc-ja.git
synced 2026-04-26 17:38:12 +02:00
efa3beb2e9
日本語訳には影響しない修正 https://github.com/php/doc-en/commit/658c808b558cab3ab64cc86f55cc9056aa7818e6
116 lines
3.6 KiB
XML
116 lines
3.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 658c808b558cab3ab64cc86f55cc9056aa7818e6 Maintainer: mumumu 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>CTRLイベント を別プロセスに送信する</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>
|
|
同じプロセスグループの別プロセスに CTRLイベント を送信する。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>event</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
送信する <literal>CTRL</literal> イベント:
|
|
<constant>PHP_WINDOWS_EVENT_CTRL_C</constant>
|
|
または <constant>PHP_WINDOWS_EVENT_CTRL_BREAK</constant>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>pid</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
イベントを送信するプロセスID。
|
|
<literal>0</literal> に設定すると、プロセスグループに属する
|
|
全てのプロセスにイベントが送信されます。
|
|
</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><function>sapi_windows_generate_ctrl_event</function> 関数の基本的な使い方</title>
|
|
<para>
|
|
以下の例は、 <literal>CTRL+BREAK</literal> イベントを子プロセスに送信する方法を示しています。
|
|
この場合、ユーザーが <literal>CTRL+BREAK</literal> を押すまで、
|
|
子プロセスは <literal>I'm still alive</literal> を1秒ごとに表示します。
|
|
<literal>CTRL+BREAK</literal> は、子プロセスのみを終了させます。
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// CTRL+BREAK イベントを子プロセスに送信する
|
|
sapi_windows_set_ctrl_handler('sapi_windows_generate_ctrl_event');
|
|
|
|
// 1秒ごとに echo する子プロセスを生成
|
|
$cmd = ['php', '-r', 'while (true) { echo "I\'m still alive\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
|
|
-->
|