moonpool/picos_std/Picos_std_structured/Run/index.html
2025-09-26 19:08:06 +00:00

12 lines
3.5 KiB
HTML
Raw 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.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Run (picos_std.Picos_std_structured.Run)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 3.1.0"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../../../index.html">Index</a> &#x00BB; <a href="../../index.html">picos_std</a> &#x00BB; <a href="../index.html">Picos_std_structured</a> &#x00BB; Run</nav><header class="odoc-preamble"><h1>Module <code><span>Picos_std_structured.Run</span></code></h1><p>Operations for running fibers in specific patterns.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec value anchored" id="val-all"><a href="#val-all" class="anchor"></a><code><span><span class="keyword">val</span> all : <span><span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> unit)</span> list</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>all actions</code> starts the actions as separate fibers and waits until they all complete or one of them raises an unhandled exception other than <a href="../Control/index.html#exception-Terminate" title="Control.Terminate"><code>Terminate</code></a>, which is not counted as an error, after which the remaining fibers will be canceled.</p><p>⚠️ One of actions may be run on the current fiber.</p><p>⚠️ It is not guaranteed that any of the actions in the list are called. In particular, after any action raises an unhandled exception or after the main fiber is canceled, the actions that have not yet started may be skipped entirely.</p><p><code>all</code> is roughly equivalent to</p><pre class="language-ocaml"><code> let all actions =
Bundle.join_after @@ fun bundle -&gt;
List.iter (Bundle.fork bundle) actions</code></pre><p>but treats the list of actions as a single computation.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-any"><a href="#val-any" class="anchor"></a><code><span><span class="keyword">val</span> any : <span><span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> unit)</span> list</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>any actions</code> starts the actions as separate fibers and waits until one of them completes or raises an unhandled exception other than <a href="../Control/index.html#exception-Terminate" title="Control.Terminate"><code>Terminate</code></a>, which is not counted as an error, after which the rest of the started fibers will be canceled.</p><p>⚠️ One of actions may be run on the current fiber.</p><p>⚠️ It is not guaranteed that any of the actions in the list are called. In particular, after the first action returns successfully or after any action raises an unhandled exception or after the main fiber is canceled, the actions that have not yet started may be skipped entirely.</p><p><code>any</code> is roughly equivalent to</p><pre class="language-ocaml"><code> let any actions =
Bundle.join_after @@ fun bundle -&gt;
try
actions
|&gt; List.iter @@ fun action -&gt;
Bundle.fork bundle @@ fun () -&gt;
action ();
Bundle.terminate bundle
with Control.Terminate -&gt; ()</code></pre><p>but treats the list of actions as a single computation.</p></div></div></div></body></html>