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
5.5 KiB

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>InferBase__ProcessPool (InferBase.InferBase__ProcessPool)</title><link rel="stylesheet" href="../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc %%VERSION%%"/><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">InferBase</a> &#x00BB; InferBase__ProcessPool</nav><h1>Module <code>InferBase__ProcessPool</code></h1><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 <code>ProcessPoolState</code>.</p></header><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 type" id="type-task_generator"><a href="#type-task_generator" class="anchor"></a><code><span class="keyword">type</span> <span>'a task_generator</span></code><code> = </code><code>{</code><table class="record"><tr id="type-task_generator.remaining_tasks" class="anchored"><td class="def field"><a href="#type-task_generator.remaining_tasks" class="anchor"></a><code>remaining_tasks : unit <span>&#45;&gt;</span> int;</code></td><td class="doc"><p>number of tasks remaining to complete -- only used for reporting, so imprecision is not a bug</p></td></tr><tr id="type-task_generator.is_empty" class="anchored"><td class="def field"><a href="#type-task_generator.is_empty" class="anchor"></a><code>is_empty : unit <span>&#45;&gt;</span> bool;</code></td><td class="doc"><p>when should the main loop of the task manager stop expecting new tasks</p></td></tr><tr id="type-task_generator.finished" class="anchored"><td class="def field"><a href="#type-task_generator.finished" class="anchor"></a><code>finished : <span class="type-var">'a</span> <span>&#45;&gt;</span> unit;</code></td><td class="doc"><p>Process pool calls <code>finished x</code> when a worker finishes item <code>x</code>. This is only called if <code>next ()</code> has previously returned <code>Some x</code> and <code>x</code> was sent to a worker.</p></td></tr><tr id="type-task_generator.next" class="anchored"><td class="def field"><a href="#type-task_generator.next" class="anchor"></a><code>next : unit <span>&#45;&gt;</span> <span><span class="type-var">'a</span> option</span>;</code></td><td class="doc"><p><code>next ()</code> generates the next work item. If <code>is_empty ()</code> is true then <code>next ()</code> must return <code>None</code>. However, it is OK to for <code>next ()</code> to return <code>None</code> when <code>is_empty</code> is false. This corresponds to the case where there is more work to be done, but it is not schedulable until some already scheduled work is finished.</p></td></tr></table><code>}</code></dt><dd><p>abstraction for generating jobs</p></dd></dl><dl><dt class="spec value"