<htmlxmlns="http://www.w3.org/1999/xhtml"><head><title>ProcessPool (infer.IBase.ProcessPool)</title><linkrel="stylesheet"href="../../../odoc.css"/><metacharset="utf-8"/><metaname="generator"content="odoc 1.5.1"/><metaname="viewport"content="width=device-width,initial-scale=1.0"/><scriptsrc="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><divclass="content"><header><nav><ahref="../index.html">Up</a>–<ahref="../../index.html">infer</a>»<ahref="../index.html">IBase</a>» ProcessPool</nav><h1>Module <code>IBase.ProcessPool</code></h1></header><divclass="spec module"id="module-TaskGenerator"><ahref="#module-TaskGenerator"class="anchor"></a><code><spanclass="keyword">module</span><ahref="TaskGenerator/index.html">TaskGenerator</a> : <spanclass="keyword">sig</span> ... <spanclass="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 "Ready" or "I'm working on task <some string>" messages that are used to respectively send them more tasks ("Do x") or update the task bar with the description provided by the child.</p><p>See also <ahref="../ProcessPoolState/index.html"><code>ProcessPoolState</code></a>.</p></aside><dl><dtclass="spec type"id="type-t"><ahref="#type-t"class="anchor"></a><code><spanclass="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><dtclass="spec value"id="val-create"><ahref="#val-create"class="anchor"></a><code><spanclass="keyword">val</span> create : <span>jobs:int</span><span>-></span><span>child_prologue:<span>(unit <span>-></span> unit)</span></span><span>-></span><span>f:<span>(<spanclass="type-var">'work</span><span>-></span><span><spanclass="type-var">'result</span> option</span>)</span></span><span>-></span><span>child_epilogue:<span>(unit <span>-></span><spanclass="type-var">'final</span>)</span></span><span>-></span><span>tasks:<span>(unit <span>-></span><span><span>(<spanclass="type-var">'work</span>,<spanclass="type-var">'result</span>)</span><ahref="TaskGenerator/index.html#type-t">TaskGenerator.t</a></span>)</span></span><span>-></span><span><span>(<spanclass="type-var">'work</span>,<spanclass="type-var">'final</span>,<spanclass="type-var">'result</span>)</span><ahref="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><dtclass="spec value"id="val-run"><ahref="#val-run"class="anchor"></a><code><spanclass="keyword">val</span> run : <span><span>(<spanclass="type-var">_</span>,<spanclass="type-var">'final</span>,<spanclass="type-var">'result</span>)</span><ahref="index.html#type-t">t</a></span><span>-></span><span><span><spanclass="type-var">'final</span> option</span><ahref="../../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>