mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-10 13:14:05 -05:00
2 lines
8 KiB
HTML
2 lines
8 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Ivar (picos_std.Picos_std_sync.Ivar)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 3.0.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_sync</a> » Ivar</nav><header class="odoc-preamble"><h1>Module <code><span>Picos_std_sync.Ivar</span></code></h1><p>An incremental or single-assignment poisonable variable.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec type anchored" id="type-t"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> <span>!'a t</span></span></code></div><div class="spec-doc"><p>Represents an incremental variable.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-create"><a href="#val-create" class="anchor"></a><code><span><span class="keyword">val</span> create : <span>unit <span class="arrow">-></span></span> <span><span class="type-var">'a</span> <a href="#type-t">t</a></span></span></code></div><div class="spec-doc"><p><code>create ()</code> returns a new empty incremental variable.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-of_value"><a href="#val-of_value" class="anchor"></a><code><span><span class="keyword">val</span> of_value : <span><span class="type-var">'a</span> <span class="arrow">-></span></span> <span><span class="type-var">'a</span> <a href="#type-t">t</a></span></span></code></div><div class="spec-doc"><p><code>of_value value</code> returns an incremental variable prefilled with the given <code>value</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-try_fill"><a href="#val-try_fill" class="anchor"></a><code><span><span class="keyword">val</span> try_fill : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span><span class="type-var">'a</span> <span class="arrow">-></span></span> bool</span></code></div><div class="spec-doc"><p><code>try_fill ivar value</code> attempts to assign the given <code>value</code> to the incremental variable. Returns <code>true</code> on success and <code>false</code> in case the variable had already been poisoned or assigned a value.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-fill"><a href="#val-fill" class="anchor"></a><code><span><span class="keyword">val</span> fill : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span><span class="type-var">'a</span> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p><code>fill ivar value</code> is equivalent to <a href="#val-try_fill" title="try_fill"><code>try_fill ivar value |> ignore</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-try_poison_at"><a href="#val-try_poison_at" class="anchor"></a><code><span><span class="keyword">val</span> try_poison_at : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span>exn <span class="arrow">-></span></span> <span><a href="../../../ocaml/Stdlib/Printexc/index.html#type-raw_backtrace">Stdlib.Printexc.raw_backtrace</a> <span class="arrow">-></span></span> bool</span></code></div><div class="spec-doc"><p><code>try_poison_at ivar exn bt</code> attempts to poison the incremental variable with the specified exception and backtrace. Returns <code>true</code> on success and <code>false</code> in case the variable had already been poisoned or assigned a value.</p><p>ℹ️ This operation is not cancelable.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-try_poison"><a href="#val-try_poison" class="anchor"></a><code><span><span class="keyword">val</span> try_poison : <span><span class="optlabel">?callstack</span>:int <span class="arrow">-></span></span> <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span>exn <span class="arrow">-></span></span> bool</span></code></div><div class="spec-doc"><p><code>try_poison ivar exn</code> is equivalent to <a href="#val-try_poison_at" title="try_poison_at"><code>try_poison_at ivar exn (Printexc.get_callstack n)</code></a> where <code>n</code> defaults to <code>0</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-poison_at"><a href="#val-poison_at" class="anchor"></a><code><span><span class="keyword">val</span> poison_at : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span>exn <span class="arrow">-></span></span> <span><a href="../../../ocaml/Stdlib/Printexc/index.html#type-raw_backtrace">Stdlib.Printexc.raw_backtrace</a> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p><code>poison_at ivar exn bt</code> is equivalent to <a href="#val-try_poison_at" title="try_poison_at"><code>try_poison_at ivar exn bt |> ignore</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-poison"><a href="#val-poison" class="anchor"></a><code><span><span class="keyword">val</span> poison : <span><span class="optlabel">?callstack</span>:int <span class="arrow">-></span></span> <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span>exn <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p><code>poison ivar exn</code> is equivalent to <a href="#val-poison_at" title="poison_at"><code>poison_at ivar exn (Printexc.get_callstack n)</code></a> where <code>n</code> defaults to <code>0</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-peek_opt"><a href="#val-peek_opt" class="anchor"></a><code><span><span class="keyword">val</span> peek_opt : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span><span class="type-var">'a</span> option</span></span></code></div><div class="spec-doc"><p><code>peek_opt ivar</code> either returns <code>Some value</code> in case the variable has been assigned the <code>value</code>, raises an exception in case the variable has been poisoned, or otherwise returns <code>None</code>, which means that the variable has not yet been poisoned or assigned a value.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-read"><a href="#val-read" class="anchor"></a><code><span><span class="keyword">val</span> read : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>read ivar</code> waits until the variable is either assigned a value or the variable is poisoned and then returns the value or raises the exception.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-read_evt"><a href="#val-read_evt" class="anchor"></a><code><span><span class="keyword">val</span> read_evt : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span><span class="type-var">'a</span> <a href="../../Picos_std_event/Event/index.html#type-t">Picos_std_event.Event.t</a></span></span></code></div><div class="spec-doc"><p><code>read_evt ivar</code> returns an event that can be committed to once the variable has either been assigned a value or has been poisoned.</p></div></div></div></body></html>
|