You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
4.0 KiB

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>ProcessPool (infer.IBase.ProcessPool)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> <a href="../../index.html">infer</a> &#x00BB; <a href="../index.html">IBase</a> &#x00BB; ProcessPool</nav><h1>Module <code>IBase.ProcessPool</code></h1></header><div class="spec module" id="module-TaskGenerator"><a href="#module-TaskGenerator" class="anchor"></a><code><span class="keyword">module</span> <a href="TaskGenerator/index.html">TaskGenerator</a> : <span class="keyword">sig</span> ... <span class="keyword">end</span></code></div><aside><p>Pool of parallel workers that can both receive tasks from the master process and start doing tasks on their own. Unix pipes are used for communication, all while refreshing a task bar periodically.</p><p>Due to ondemand analysis, workers may do tasks unprompted (eg, when analysing a procedure, a process will typically end up analysing all its callees). Thus, children need to update the main process (which is in charge of the task bar) whenever they start analysing a new procedure, and whenever they resume analysing a previous procedure. This is more complicated than what, eg, `ParMap` can handle because of the bidirectional flow between children and parents.</p><p>The children send &quot;Ready&quot; or &quot;I'm working on task &lt;some string&gt;&quot; messages that are used to respectively send them more tasks (&quot;Do x&quot;) or update the task bar with the description provided by the child.</p><p>See also <a href="../ProcessPoolState/index.html"><code>ProcessPoolState</code></a>.</p></aside><dl><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type</span> <span>(_, _, _) t</span></code></dt><dd><p>A <code>('work, 'final) t</code> process pool accepts tasks of type <code>'work</code> and produces an array of results of type <code>'final</code>. <code>'work</code> and <code>'final</code> will be marshalled over a Unix pipe.</p></dd></dl><dl><dt class="spec value" id="val-create"><a href="#val-create" class="anchor"></a><code><span class="keyword">val</span> create : <span>jobs:int</span> <span>&#45;&gt;</span> <span>child_prologue:<span>(unit <span>&#45;&gt;</span> unit)</span></span> <span>&#45;&gt;</span> <span>f:<span>(<span class="type-var">'work</span> <span>&#45;&gt;</span> <span><span class="type-var">'result</span> option</span>)</span></span> <span>&#45;&gt;</span> <span>child_epilogue:<span>(unit <span>&#45;&gt;</span> <span class="type-var">'final</span>)</span></span> <span>&#45;&gt;</span> <span>tasks:<span>(unit <span>&#45;&gt;</span> <span><span>(<span class="type-var">'work</span>, <span class="type-var">'result</span>)</span> <a href="TaskGenerator/index.html#type-t">TaskGenerator.t</a></span>)</span></span> <span>&#45;&gt;</span> <span><span>(<span class="type-var">'work</span>, <span class="type-var">'final</span>, <span class="type-var">'result</span>)</span> <a href="index.html#type-t">t</a></span></code></dt><dd><p>Create a new pool of processes running <code>jobs</code> jobs in parallel</p></dd></dl><dl><dt class="spec value" id="val-run"><a href="#val-run" class="anchor"></a><code><span class="keyword">val</span> run : <span><span>(<span class="type-var">_</span>, <span class="type-var">'final</span>, <span class="type-var">'result</span>)</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span><span class="type-var">'final</span> option</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.Array.t</span></code></dt><dd><p>use the processes in the given process pool to run all the given tasks in parallel and return the results of the epilogues</p></dd></dl></div></body></html>