1
0
mirror of https://github.com/php/doc-tr.git synced 2026-03-24 15:22:23 +01:00
Files
archived-doc-tr/reference/pcntl/examples.xml
2021-03-15 20:01:43 +03:00

89 lines
1.8 KiB
XML
Raw Permalink 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: aebf045bfb7f4f2350db5e1e908cf290be334075 Maintainer: nilgun Status: ready -->
<chapter xml:id="pcntl.examples" xmlns="http://docbook.org/ns/docbook">
&reftitle.examples;
<section xml:id="pcntl.example">
<title>Temel kullanım</title>
<para>
Bu örnekte bir sinyal eylemci ile bir artalan süreci çocuk süreç haline
gelmektedir.
</para>
<example>
<title>- Süreç Denetimi örneği</title>
<programlisting role="php">
<![CDATA[
<?php
declare(ticks=1);
$pid = pcntl_fork();
if ($pid == -1) {
die("çatallama yapılamadı");
} else if ($pid) {
exit(); // Ana süreç
} else {
// Çocuk süreç
}
// denetim uçbirimini terkedelim
if (posix_setsid() == -1) {
die("uçbirim terkedilemedi");
}
// sinyal eylemcilerimizi tanıtalım
pcntl_signal(SIGTERM, "sig_handler");
pcntl_signal(SIGHUP, "sig_handler");
// Görevler yerine getirilene kadar döngüde kalalım
while (1) {
// işe yarar şeyler burada
}
function sig_handler($signo)
{
switch ($signo) {
case SIGTERM:
// Kapanma işlemleri
exit;
break;
case SIGHUP:
// Yeniden başlatma işlemleri
break;
default:
// Tüm diğer sinyallerle ilgili işlemler
}
}
?>
]]>
</programlisting>
</example>
</section>
</chapter>
<!-- 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
-->