Skip to content
Merged
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
34 changes: 34 additions & 0 deletions language/predefined/fiber/throw.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,40 @@
</para>
</refsect1>

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

$fiber = new Fiber(function () {
try {
// Suspend execution of the fiber declaring an interruption point
Fiber::suspend();
} catch (Throwable $e) {
echo $e->getMessage();
}
});

$fiber->start();

// Resumes execution of the fiber with
// passing the Exception to throw at the interruption point
$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