moonpool/picos/Picos/Fiber/FLS/index.html
2024-09-04 16:10:21 +00:00

2 lines
5.3 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>FLS (picos.Picos.Fiber.FLS)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 2.4.2"/><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">picos</a> &#x00BB; <a href="../../index.html">Picos</a> &#x00BB; <a href="../index.html">Fiber</a> &#x00BB; FLS</nav><header class="odoc-preamble"><h1>Module <code><span>Fiber.FLS</span></code></h1><p>Fiber local storage</p><p>Fiber local storage is intended for use as a low overhead storage mechanism for fiber extensions. For example, one might associate a priority value with each fiber for a scheduler that uses a priority queue or one might use FLS to store unique id values for fibers.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec type subst anchored" id="type-fiber"><a href="#type-fiber" class="anchor"></a><code><span><span class="keyword">type</span> fiber</span><span> := <a href="../index.html#type-t">t</a></span></code></div><div class="spec-doc"><p>Destructively substituted alias for <a href="../index.html#type-t"><code>Fiber.t</code></a>.</p></div></div><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 a key for storing values of type <code>'a</code> in storage associated with fibers.</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">&#45;&gt;</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>new_key initial</code> allocates a new key for associating values in storage associated with fibers. The <code>initial</code> value for every fiber is either the given <code>Constant</code> or is <code>Computed</code> with the given function. If the initial value is a constant, no value needs to be stored unless the value is explicitly updated.</p><p>⚠️ New keys should not be created dynamically.</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Not_set"><a href="#exception-Not_set" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Not_set</span></span></code></div><div class="spec-doc"><p>Raised by <a href="#val-get_exn"><code>get_exn</code></a> in case value has not been <a href="#val-set"><code>set</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_exn"><a href="#val-get_exn" class="anchor"></a><code><span><span class="keyword">val</span> get_exn : <span><a href="#type-fiber">fiber</a> <span class="arrow">&#45;&gt;</span></span> <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>get_exn fiber key</code> returns the value associated with the <code>key</code> in the storage associated with the <code>fiber</code> or raises <a href="#exception-Not_set"><code>Not_set</code></a> using <code>raise_notrace</code>.</p><p>⚠️ It is only safe to call <code>get_exn</code> from the fiber itself or when the fiber is known not to be running.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get"><a href="#val-get" class="anchor"></a><code><span><span class="keyword">val</span> get : <span><a href="#type-fiber">fiber</a> <span class="arrow">&#45;&gt;</span></span> <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="label">default</span>:<span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>get fiber key ~default</code> returns the value associated with the <code>key</code> in the storage associated with the <code>fiber</code> or the <code>default</code> value.</p><p>⚠️ It is only safe to call <code>get</code> from the fiber itself or when the fiber is known not to be running.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set"><a href="#val-set" class="anchor"></a><code><span><span class="keyword">val</span> set : <span><a href="#type-fiber">fiber</a> <span class="arrow">&#45;&gt;</span></span> <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>set fiber key value</code> sets the <code>value</code> associated with the <code>key</code> to the given value in the storage associated with the <code>fiber</code>.</p><p>⚠️ It is only safe to call <code>set</code> from the fiber itself or when the fiber is known not to be running.</p></div></div></div></body></html>