Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion language/predefined/fiber/throw.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 8fee3ae9715ffa15922469eb7d98f4878917a6ee Maintainer: samesch Status: ready -->
<!-- EN-Revision: b3a0b9924ba577a3abf246c1bd1a6cf5c4bf14dc Maintainer: samesch Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="fiber.throw" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
Expand Down Expand Up @@ -48,6 +48,40 @@
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<informalexample>
<programlisting role="php">
<![CDATA[
<?php

$fiber = new Fiber(function () {
try {
// Unterbricht die Ausführung der Fiber und deklariert dabei einen Unterbrechungspunkt
Fiber::suspend();
} catch (Throwable $e) {
echo $e->getMessage();
}
});

$fiber->start();

// Setzt die Ausführung der Fiber fort und übergibt
// die Exception, die am aktuellen Unterbrechungspunkt geworfen werden soll
$fiber->throw(new Exception('Message of an exception thrown at the current interrupt point'));

?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Message of an exception thrown at the current interrupt point
]]>
</screen>
</informalexample>
</refsect1>

</refentry>
<!-- Keep this comment at the end of the file
Local variables:
Expand Down
Loading