mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
12 lines
3.5 KiB
HTML
12 lines
3.5 KiB
HTML
<!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> » <a href="../../index.html">picos_std</a> » <a href="../index.html">Picos_std_structured</a> » 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">-></span></span> unit)</span> list</span> <span class="arrow">-></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 ->
|
||
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">-></span></span> unit)</span> list</span> <span class="arrow">-></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 ->
|
||
try
|
||
actions
|
||
|> List.iter @@ fun action ->
|
||
Bundle.fork bundle @@ fun () ->
|
||
action ();
|
||
Bundle.terminate bundle
|
||
with Control.Terminate -> ()</code></pre><p>but treats the list of actions as a single computation.</p></div></div></div></body></html>
|