mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-14 06:46:15 -05:00
deploy: 0d8767f45f
This commit is contained in:
parent
4a5a83276c
commit
87dd8d59e7
9 changed files with 21 additions and 7 deletions
|
|
@ -1,4 +1,11 @@
|
||||||
|
|
||||||
|
# 0.7
|
||||||
|
|
||||||
|
- add `Moonpool_fiber.spawn_top_ignore`
|
||||||
|
- add `moonpool-io`, based on `picos_io` (still very experimental)
|
||||||
|
- move to picos as the foundation layer for concurrency primitives (#30)
|
||||||
|
- move to `thread-local-storage` 0.2 with get/set API
|
||||||
|
|
||||||
# 0.6
|
# 0.6
|
||||||
|
|
||||||
- breaking: remove `Immediate_runner` (bug prone and didn't
|
- breaking: remove `Immediate_runner` (bug prone and didn't
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -10,4 +10,4 @@ let compute_foo =
|
||||||
return_foo ()
|
return_foo ()
|
||||||
(* exit critical section *)
|
(* exit critical section *)
|
||||||
in
|
in
|
||||||
…</code></pre><p>This lock is based on <code>Picos_sync.Mutex</code> so it is <code>await</code>-safe.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> NEXT_RELEASE</li></ul></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>A value protected by a cooperative mutex</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><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>Create a new protected value.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_"><a href="#val-with_" class="anchor"></a><code><span><span class="keyword">val</span> with_ : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span><span>(<span><span class="type-var">'a</span> <span class="arrow">-></span></span> <span class="type-var">'b</span>)</span> <span class="arrow">-></span></span> <span class="type-var">'b</span></span></code></div><div class="spec-doc"><p><code>with_ l f</code> runs <code>f x</code> where <code>x</code> is the value protected with the lock <code>l</code>, in a critical section. If <code>f x</code> fails, <code>with_lock l f</code> fails too but the lock is released.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-update"><a href="#val-update" class="anchor"></a><code><span><span class="keyword">val</span> update : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span><span>(<span><span class="type-var">'a</span> <span class="arrow">-></span></span> <span class="type-var">'a</span>)</span> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p><code>update l f</code> replaces the content <code>x</code> of <code>l</code> with <code>f x</code>, while protected by the mutex.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-update_map"><a href="#val-update_map" class="anchor"></a><code><span><span class="keyword">val</span> update_map : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span><span>(<span><span class="type-var">'a</span> <span class="arrow">-></span></span> <span class="type-var">'a</span> * <span class="type-var">'b</span>)</span> <span class="arrow">-></span></span> <span class="type-var">'b</span></span></code></div><div class="spec-doc"><p><code>update_map l f</code> computes <code>x', y = f (get l)</code>, then puts <code>x'</code> in <code>l</code> and returns <code>y</code>, while protected by the mutex.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-mutex"><a href="#val-mutex" class="anchor"></a><code><span><span class="keyword">val</span> mutex : <span><span><span class="type-var">_</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <a href="../../../picos_std/Picos_std_sync/Mutex/index.html#type-t">Picos_std_sync.Mutex.t</a></span></code></div><div class="spec-doc"><p>Underlying mutex.</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><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>Atomically get the value in the lock. The value that is returned isn't protected!</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>Atomically set the value.</p><p><b>NOTE</b> caution: using <a href="#val-get"><code>get</code></a> and <a href="#val-set"><code>set</code></a> as if this were a <code>ref</code> is an anti pattern and will not protect data against some race conditions.</p></div></div></div></body></html>
|
…</code></pre><p>This lock is based on <code>Picos_sync.Mutex</code> so it is <code>await</code>-safe.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.7</li></ul></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>A value protected by a cooperative mutex</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><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>Create a new protected value.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_"><a href="#val-with_" class="anchor"></a><code><span><span class="keyword">val</span> with_ : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span><span>(<span><span class="type-var">'a</span> <span class="arrow">-></span></span> <span class="type-var">'b</span>)</span> <span class="arrow">-></span></span> <span class="type-var">'b</span></span></code></div><div class="spec-doc"><p><code>with_ l f</code> runs <code>f x</code> where <code>x</code> is the value protected with the lock <code>l</code>, in a critical section. If <code>f x</code> fails, <code>with_lock l f</code> fails too but the lock is released.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-update"><a href="#val-update" class="anchor"></a><code><span><span class="keyword">val</span> update : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span><span>(<span><span class="type-var">'a</span> <span class="arrow">-></span></span> <span class="type-var">'a</span>)</span> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p><code>update l f</code> replaces the content <code>x</code> of <code>l</code> with <code>f x</code>, while protected by the mutex.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-update_map"><a href="#val-update_map" class="anchor"></a><code><span><span class="keyword">val</span> update_map : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <span><span>(<span><span class="type-var">'a</span> <span class="arrow">-></span></span> <span class="type-var">'a</span> * <span class="type-var">'b</span>)</span> <span class="arrow">-></span></span> <span class="type-var">'b</span></span></code></div><div class="spec-doc"><p><code>update_map l f</code> computes <code>x', y = f (get l)</code>, then puts <code>x'</code> in <code>l</code> and returns <code>y</code>, while protected by the mutex.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-mutex"><a href="#val-mutex" class="anchor"></a><code><span><span class="keyword">val</span> mutex : <span><span><span class="type-var">_</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> <a href="../../../picos_std/Picos_std_sync/Mutex/index.html#type-t">Picos_std_sync.Mutex.t</a></span></code></div><div class="spec-doc"><p>Underlying mutex.</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><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>Atomically get the value in the lock. The value that is returned isn't protected!</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>Atomically set the value.</p><p><b>NOTE</b> caution: using <a href="#val-get"><code>get</code></a> and <a href="#val-set"><code>set</code></a> as if this were a <code>ref</code> is an anti pattern and will not protect data against some race conditions.</p></div></div></div></body></html>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,11 @@
|
||||||
|
|
||||||
|
# 0.7
|
||||||
|
|
||||||
|
- add `Moonpool_fiber.spawn_top_ignore`
|
||||||
|
- add `moonpool-io`, based on `picos_io` (still very experimental)
|
||||||
|
- move to picos as the foundation layer for concurrency primitives (#30)
|
||||||
|
- move to `thread-local-storage` 0.2 with get/set API
|
||||||
|
|
||||||
# 0.6
|
# 0.6
|
||||||
|
|
||||||
- breaking: remove `Immediate_runner` (bug prone and didn't
|
- breaking: remove `Immediate_runner` (bug prone and didn't
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue