mirror of
https://github.com/c-cube/linol.git
synced 2025-12-09 12:45:53 -05:00
2 lines
2.4 KiB
HTML
2 lines
2.4 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Lwt_gc (lwt.Lwt_gc)</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> » <a href="../index.html">lwt</a> » Lwt_gc</nav><header class="odoc-preamble"><h1>Module <code><span>Lwt_gc</span></code></h1><p>Interaction with the garbage collector</p></header><div class="odoc-content"><p>This module offers a convenient way to add a finaliser launching a thread to a value, without having to use <code>Lwt_unix.run</code> in the finaliser.</p><div class="odoc-spec"><div class="spec value anchored" id="val-finalise"><a href="#val-finalise" class="anchor"></a><code><span><span class="keyword">val</span> finalise : <span><span>(<span><span class="type-var">'a</span> <span class="arrow">-></span></span> <span>unit <a href="../Lwt/index.html#type-t">Lwt.t</a></span>)</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>finalise f x</code> ensures <code>f x</code> is evaluated after <code>x</code> has been garbage collected. If <code>f x</code> yields, then Lwt will wait for its termination at the end of the program.</p><p>Note that <code>f x</code> is not called at garbage collection time, but later in the main loop.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-finalise_or_exit"><a href="#val-finalise_or_exit" class="anchor"></a><code><span><span class="keyword">val</span> finalise_or_exit : <span><span>(<span><span class="type-var">'a</span> <span class="arrow">-></span></span> <span>unit <a href="../Lwt/index.html#type-t">Lwt.t</a></span>)</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>finalise_or_exit f x</code> call <code>f x</code> when <code>x</code> is garbage collected or (exclusively) when the program exits.</p></div></div></div></body></html>
|