summaryrefslogtreecommitdiff
path: root/devdocs/elisp/transaction-queues.html
blob: 97afaf4a37285988f65e2b9b2c72df121111e0bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 <h3 class="section">Transaction Queues</h3>  <p>You can use a <em>transaction queue</em> to communicate with a subprocess using transactions. First use <code>tq-create</code> to create a transaction queue communicating with a specified process. Then you can call <code>tq-enqueue</code> to send a transaction. </p> <dl> <dt id="tq-create">Function: <strong>tq-create</strong> <em>process</em>
</dt> <dd><p>This function creates and returns a transaction queue communicating with <var>process</var>. The argument <var>process</var> should be a subprocess capable of sending and receiving streams of bytes. It may be a child process, or it may be a TCP connection to a server, possibly on another machine. </p></dd>
</dl> <dl> <dt id="tq-enqueue">Function: <strong>tq-enqueue</strong> <em>queue question regexp closure fn &amp;optional delay-question</em>
</dt> <dd>
<p>This function sends a transaction to queue <var>queue</var>. Specifying the queue has the effect of specifying the subprocess to talk to. </p> <p>The argument <var>question</var> is the outgoing message that starts the transaction. The argument <var>fn</var> is the function to call when the corresponding answer comes back; it is called with two arguments: <var>closure</var>, and the answer received. </p> <p>The argument <var>regexp</var> is a regular expression that should match text at the end of the entire answer, but nothing before; that’s how <code>tq-enqueue</code> determines where the answer ends. </p> <p>If the argument <var>delay-question</var> is non-<code>nil</code>, delay sending this question until the process has finished replying to any previous questions. This produces more reliable results with some processes. </p>
</dd>
</dl> <dl> <dt id="tq-close">Function: <strong>tq-close</strong> <em>queue</em>
</dt> <dd><p>Shut down transaction queue <var>queue</var>, waiting for all pending transactions to complete, and then terminate the connection or child process. </p></dd>
</dl> <p>Transaction queues are implemented by means of a filter function. See <a href="filter-functions">Filter Functions</a>. </p><div class="_attribution">
  <p class="_attribution-p">
    Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
    <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Transaction-Queues.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Transaction-Queues.html</a>
  </p>
</div>