This commit is contained in:
c-cube 2025-03-13 14:13:33 +00:00
parent d6e0fbdd5a
commit 0fdd0ab782
2 changed files with 2 additions and 2 deletions

View file

@ -1,2 +1,2 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Main (moonpool.Moonpool_fib.Main)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 2.4.4"/><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">moonpool</a> &#x00BB; <a href="../index.html">Moonpool_fib</a> &#x00BB; Main</nav><header class="odoc-preamble"><h1>Module <code><span>Moonpool_fib.Main</span></code></h1><p>Main thread.</p><p>This is evolved from <code>Moonpool.Immediate_runner</code>, but unlike it, this API assumes you run it in a thread (possibly the main thread) which will block until the initial computation is done.</p><p>This means it's reasonable to use <code>Main.main (fun () -&gt; do_everything)</code> at the beginning of the program. Other Moonpool pools can be created for background tasks, etc. to do the heavy lifting, and the main thread (inside this immediate runner) can coordinate tasks via <code>Fiber.await</code>.</p><p>Aside from the fact that this blocks the caller thread, it is fairly similar to <code>Background_thread</code> in that there's a single worker to process tasks/fibers.</p><p>This handles effects, including the ones in <a href="../Fiber/index.html"><code>Fiber</code></a>.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.6</li></ul></header><div class="odoc-content"><div class="odoc-spec"><div class="spec value anchored" id="val-main"><a href="#val-main" class="anchor"></a><code><span><span class="keyword">val</span> main : <span><span>(<span><a href="../../Moonpool/Runner/index.html#type-t">Moonpool.Runner.t</a> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>main f</code> runs <code>f()</code> in a scope that handles effects, including <a href="../Fiber/index.html#val-await"><code>Fiber.await</code></a>.</p><p>This scope can run background tasks as well, in a cooperative fashion.</p></div></div></div></body></html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Main (moonpool.Moonpool_fib.Main)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 2.4.4"/><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">moonpool</a> &#x00BB; <a href="../index.html">Moonpool_fib</a> &#x00BB; Main</nav><header class="odoc-preamble"><h1>Module <code><span>Moonpool_fib.Main</span></code></h1><p>Main thread.</p><p>This is evolved from <code>Moonpool.Immediate_runner</code>, but unlike it, this API assumes you run it in a thread (possibly the main thread) which will block until the initial computation is done.</p><p>This means it's reasonable to use <code>Main.main (fun () -&gt; do_everything)</code> at the beginning of the program. Other Moonpool pools can be created for background tasks, etc. to do the heavy lifting, and the main thread (inside this immediate runner) can coordinate tasks via <code>Fiber.await</code>.</p><p>Aside from the fact that this blocks the caller thread, it is fairly similar to <code>Background_thread</code> in that there's a single worker to process tasks/fibers.</p><p>This handles effects, including the ones in <a href="../Fiber/index.html"><code>Fiber</code></a>.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.6</li></ul></header><div class="odoc-content"><div class="odoc-spec"><div class="spec value anchored" id="val-main"><a href="#val-main" class="anchor"></a><code><span><span class="keyword">val</span> main : <span><span>(<span><a href="../../Moonpool/Runner/index.html#type-t">Moonpool.Runner.t</a> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>main f</code> runs <code>f()</code> in a scope that handles effects, including <a href="../Fiber/index.html#val-await"><code>Fiber.await</code></a>.</p><p>This scope can run background tasks as well, in a cooperative fashion.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-main'"><a href="#val-main'" class="anchor"></a><code><span><span class="keyword">val</span> main' : <span><span class="optlabel">?block_signals</span>:bool <span class="arrow">&#45;&gt;</span></span> <span>unit <span class="arrow">&#45;&gt;</span></span> <span><span>(<span><a href="../../Moonpool/Runner/index.html#type-t">Moonpool.Runner.t</a> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p>Same as <a href="#val-main"><code>main</code></a> but with room for optional arguments.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> NEXT_RELEASE</li></ul></div></div></div></body></html>

View file

@ -3,4 +3,4 @@
<span><span class="optlabel">?on</span>:<a href="../Moonpool/Runner/index.html#type-t">Moonpool.Runner.t</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?protect</span>:bool <span class="arrow">&#45;&gt;</span></span>
<span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">_</span>)</span> <span class="arrow">&#45;&gt;</span></span>
unit</span></code></div><div class="spec-doc"><p><code>spawn_ignore f</code> is <code>ignore (spawn f)</code>. The fiber will still affect termination of the parent, ie. the parent will exit only after this new fiber exits.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">on</span> <p>the optional runner to use, added since NEXT_RELEASE</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-spawn_top_ignore"><a href="#val-spawn_top_ignore" class="anchor"></a><code><span><span class="keyword">val</span> spawn_top_ignore : <span><span class="label">on</span>:<a href="../Moonpool/Runner/index.html#type-t">Moonpool.Runner.t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">_</span>)</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Like <a href="#val-spawn_top"><code>spawn_top</code></a> but ignores the result.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.7</li></ul></div></div></details></div><div class="odoc-include"><details open="open"><summary class="spec include"><code><span><span class="keyword">include</span> <span class="keyword">module</span> <span class="keyword">type</span> <span class="keyword">of</span> <span class="keyword">struct</span> <span class="keyword">include</span> <a href="Main/index.html">Main</a> <span class="keyword">end</span></span></code></summary><div class="odoc-spec"><div class="spec value anchored" id="val-main"><a href="#val-main" class="anchor"></a><code><span><span class="keyword">val</span> main : <span><span>(<span><a href="../Moonpool/Runner/index.html#type-t">Moonpool.Runner.t</a> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>main f</code> runs <code>f()</code> in a scope that handles effects, including <a href="Fiber/index.html#val-await"><code>Fiber.await</code></a>.</p><p>This scope can run background tasks as well, in a cooperative fashion.</p></div></div></details></div></div></body></html>
unit</span></code></div><div class="spec-doc"><p><code>spawn_ignore f</code> is <code>ignore (spawn f)</code>. The fiber will still affect termination of the parent, ie. the parent will exit only after this new fiber exits.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">on</span> <p>the optional runner to use, added since NEXT_RELEASE</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-spawn_top_ignore"><a href="#val-spawn_top_ignore" class="anchor"></a><code><span><span class="keyword">val</span> spawn_top_ignore : <span><span class="label">on</span>:<a href="../Moonpool/Runner/index.html#type-t">Moonpool.Runner.t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">_</span>)</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Like <a href="#val-spawn_top"><code>spawn_top</code></a> but ignores the result.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.7</li></ul></div></div></details></div><div class="odoc-include"><details open="open"><summary class="spec include"><code><span><span class="keyword">include</span> <span class="keyword">module</span> <span class="keyword">type</span> <span class="keyword">of</span> <span class="keyword">struct</span> <span class="keyword">include</span> <a href="Main/index.html">Main</a> <span class="keyword">end</span></span></code></summary><div class="odoc-spec"><div class="spec value anchored" id="val-main"><a href="#val-main" class="anchor"></a><code><span><span class="keyword">val</span> main : <span><span>(<span><a href="../Moonpool/Runner/index.html#type-t">Moonpool.Runner.t</a> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>main f</code> runs <code>f()</code> in a scope that handles effects, including <a href="Fiber/index.html#val-await"><code>Fiber.await</code></a>.</p><p>This scope can run background tasks as well, in a cooperative fashion.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-main'"><a href="#val-main'" class="anchor"></a><code><span><span class="keyword">val</span> main' : <span><span class="optlabel">?block_signals</span>:bool <span class="arrow">&#45;&gt;</span></span> <span>unit <span class="arrow">&#45;&gt;</span></span> <span><span>(<span><a href="../Moonpool/Runner/index.html#type-t">Moonpool.Runner.t</a> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p>Same as <a href="#val-main"><code>main</code></a> but with room for optional arguments.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> NEXT_RELEASE</li></ul></div></div></details></div></div></body></html>