moonpool/picos_std/Picos_std_sync/Semaphore/Binary/index.html
2025-09-26 19:08:06 +00:00

2 lines
3 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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>Binary (picos_std.Picos_std_sync.Semaphore.Binary)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 3.1.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> &#x00BB; <a href="../../../index.html">picos_std</a> &#x00BB; <a href="../../index.html">Picos_std_sync</a> &#x00BB; <a href="../index.html">Semaphore</a> &#x00BB; Binary</nav><header class="odoc-preamble"><h1>Module <code><span>Semaphore.Binary</span></code></h1><p>A binary semaphore.</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> t</span></code></div><div class="spec-doc"><p>Represents a binary semaphore.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-make"><a href="#val-make" class="anchor"></a><code><span><span class="keyword">val</span> make : <span><span class="optlabel">?padded</span>:bool <span class="arrow">&#45;&gt;</span></span> <span>bool <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p><code>make initial</code> creates a new binary semaphore with count of <code>1</code> in case <code>initial</code> is <code>true</code> and count of <code>0</code> otherwise.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-release"><a href="#val-release" class="anchor"></a><code><span><span class="keyword">val</span> release : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>release semaphore</code> sets the count of the semaphore to <code>1</code>.</p><p> This operation is not cancelable.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-acquire"><a href="#val-acquire" class="anchor"></a><code><span><span class="keyword">val</span> acquire : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>acquire semaphore</code> waits until the count of the semaphore is <code>1</code> and then atomically changes the count to <code>0</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-try_acquire"><a href="#val-try_acquire" class="anchor"></a><code><span><span class="keyword">val</span> try_acquire : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p><code>try_acquire semaphore</code> attempts to atomically change the count of the semaphore from <code>1</code> to <code>0</code>.</p></div></div></div></body></html>