mirror of
https://github.com/c-cube/nanoev.git
synced 2025-12-06 11:15:48 -05:00
2 lines
3.6 KiB
HTML
2 lines
3.6 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>TLS (picos.Picos_thread.TLS)</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</a> » <a href="../index.html">Picos_thread</a> » TLS</nav><header class="odoc-preamble"><h1>Module <code><span>Picos_thread.TLS</span></code></h1><p>Thread-local storage.</p><p>Note that here "thread" refers to system level threads rather than fibers or domains. In case a system level thread implementation, i.e. the <code>threads.posix</code> library, is not available, this will use <a href="../../Picos_domain/DLS/index.html"><code>Picos_domain.DLS</code></a>.</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 a key for associating values with threads.</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> allocates a new key for associating values with threads.</p><p>⚠️ Keys should not be created dynamically as each key will potentially increase the space taken by every thread.</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>Exception raised by <a href="#val-get_exn"><code>get_exn</code></a> when no value is associated with the specified key for the current thread.</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><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>get_exn key</code> returns the value associated with the specified key for the current thread or raises <a href="#exception-Not_set"><code>Not_set</code></a> in case no value has been <a href="#val-set"><code>set</code></a> for the key.</p><p>⚠️ The <a href="#exception-Not_set"><code>Not_set</code></a> exception is raised with no backtrace. Always catch the exception unless it is known that a value has been set.</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><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>set key value</code> associates the value with the specified key for the current thread.</p></div></div></div></body></html>
|