| <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>exit</title><link rel="stylesheet" type="text/css" href="rivet.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="Apache Rivet 3.2"><link rel="up" href="commands.html" title="Rivet Tcl Commands and Variables"><link rel="prev" href="escape_string.html" title="escape_string"><link rel="next" href="headers.html" title="headers"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">exit</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="escape_string.html"><img src="images/prev.png" alt="Prev"></a> </td><th width="60%" align="center">Rivet Tcl Commands and Variables</th><td width="20%" align="right"> <a accesskey="n" href="headers.html"><img src="images/next.png" alt="Next"></a></td></tr></table></div><div class="refentry"><div class="refentry.separator"><hr></div><a name="exit"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>exit — terminate execution and child process</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis" style="width:80%"><div style="border: 1px solid #282; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">::rivet::exit</span> ?<span style="font-family:monospace; font-weight: bold;">code</span>?</div></div></div><div class="refsect1"><a name="idm1142"></a><h2>Description</h2><p style="width:90%"> |
| Replaces Tcl's <span style="font-family:monospace"><span class="command"><strong>exit</strong></span></span> core command. <span style="font-family:monospace"><span class="command"><strong>::rivet::exit</strong></span></span> |
| interrupts execution of the current script and passes execution to AbortScript if |
| such script is set. After AbortScript has finished and request processing completed |
| the child process is forced to exit by eventually calling Tcl_Exit producing the same final |
| effect of the core command. |
| During an <span style="font-family:monospace"><span class="command"><strong>AbortScript</strong></span></span> execution the |
| exit condition can be detected |
| </p><pre class="programlisting">if {[<span style="font-family:monospace"><span class="command"><strong>::rivet::abort_page -exiting</strong></span></span>]} { |
| ...handle exit condition |
| }</pre><p style="width:90%"> |
| </p><p style="width:90%"> |
| <span style="font-family:monospace"><span class="command"><strong>::rivet::exit</strong></span></span> has a single optional argument ?<span style="font-family:monospace; font-weight: bold;">code</span>?. This |
| value must be a positive integer number to be passed to Tcl_Exit. If any other value is |
| given ?<span style="font-family:monospace; font-weight: bold;">code</span>? is set to 0. The exit code can be obtained from the dictionary |
| returned by <span style="font-family:monospace"><span class="command"><strong>::rivet::abort_code</strong></span></span> |
| </p><pre class="programlisting">[::rivet::abort_code] |
| <== return_code ?<span style="font-family:monospace; font-weight: bold;">code</span>? error_code exit</pre><p style="width:90%"> |
| Rivet's specific implementation prevents any abrupt process termination |
| that otherwise the <span style="font-family:monospace"><span class="command"><strong>exit</strong></span></span> command would bring about deferring |
| the call to Tcl_Exit to a later stage when the request processing has finished. |
| This is always true if the mod_rivet runs the prefork bridge. The behavior with |
| the worker bridge depends on the <span style="font-family:monospace"><span class="command"><strong>SingleThreadExit</strong></span></span> configuration |
| directive. By default all the threads of a single process are requested to exit |
| before the child process exits. Starting with version 3.2 |
| by setting the <span style="font-family:monospace"><span class="command"><strong>SingleThreadExit</strong></span></span> option directive |
| calling <span style="font-family:monospace"><span class="command"><strong>::rivet::exit</strong></span></span> causes a single thread termination. |
| Though always accepted this directive is meaningful only if used with the worker |
| or lazy bridges. |
| </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"> |
| Nonetheless we discourage the programmer to use such command, and suggest to focus on proper |
| application design and avoid such a drastic way to bail out. |
| If you need to restart the child processes from time to time we recommend to check the |
| MaxRequests parameter in the |
| <a class="ulink" href="https://httpd.apache.org/docs/2.4/mod/prefork.html" target="_top">prefork MPM documentation</a> |
| or the |
| <a class="ulink" href="http://httpd.apache.org/docs/2.4/mod/mpm_common.html#maxrequestsperchild" target="_top">MaxRequestsPerChild</a> |
| configuration parameter |
| </td></tr></table></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="escape_string.html"><img src="images/prev.png" alt="Prev"></a> </td><td width="20%" align="center"><a accesskey="u" href="commands.html"><img src="images/up.png" alt="Up"></a></td><td width="40%" align="right"> <a accesskey="n" href="headers.html"><img src="images/next.png" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">escape_string </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a></td><td width="40%" align="right" valign="top"> headers</td></tr></table></div></body></html> |