apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject svn commit: r151768 [37/47] - in apr/site/trunk/docs/docs/apr: ./ iconv/ util/
Date Mon, 07 Feb 2005 23:12:23 GMT
Modified: apr/site/trunk/docs/docs/apr/apr__thread__proc_8h-source.html
URL: http://svn.apache.org/viewcvs/apr/site/trunk/docs/docs/apr/apr__thread__proc_8h-source.html?view=diff&r1=151767&r2=151768
==============================================================================
--- apr/site/trunk/docs/docs/apr/apr__thread__proc_8h-source.html (original)
+++ apr/site/trunk/docs/docs/apr/apr__thread__proc_8h-source.html Mon Feb  7 15:10:17 2005
@@ -3,786 +3,808 @@
 <title>Apache Portable Runtime: apr_thread_proc.h Source File</title>
 <link href="doxygen.css" rel="stylesheet" type="text/css">
 </head><body>
-<!-- Generated by Doxygen 1.3.8 -->
+<!-- Generated by Doxygen 1.3.7 -->
 <div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
-<h1>apr_thread_proc.h</h1><a href="apr__thread__proc_8h.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">/* Copyright 2000-2004 The Apache Software Foundation</span>
-00002 <span class="comment"> *</span>
-00003 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span>
-00004 <span class="comment"> * you may not use this file except in compliance with the License.</span>
-00005 <span class="comment"> * You may obtain a copy of the License at</span>
-00006 <span class="comment"> *</span>
-00007 <span class="comment"> *     http://www.apache.org/licenses/LICENSE-2.0</span>
-00008 <span class="comment"> *</span>
-00009 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
-00010 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span>
-00011 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
-00012 <span class="comment"> * See the License for the specific language governing permissions and</span>
-00013 <span class="comment"> * limitations under the License.</span>
-00014 <span class="comment"> */</span>
-00015 
-00016 <span class="preprocessor">#ifndef APR_THREAD_PROC_H</span>
-00017 <span class="preprocessor"></span><span class="preprocessor">#define APR_THREAD_PROC_H</span>
-00018 <span class="preprocessor"></span><span class="comment"></span>
-00019 <span class="comment">/**</span>
-00020 <span class="comment"> * @file apr_thread_proc.h</span>
-00021 <span class="comment"> * @brief APR Thread and Process Library</span>
-00022 <span class="comment"> */</span>
-00023 
-00024 <span class="preprocessor">#include "apr.h"</span>
-00025 <span class="preprocessor">#include "<a class="code" href="apr__file__io_8h.html">apr_file_io.h</a>"</span>
-00026 <span class="preprocessor">#include "<a class="code" href="apr__pools_8h.html">apr_pools.h</a>"</span>
-00027 <span class="preprocessor">#include "<a class="code" href="apr__errno_8h.html">apr_errno.h</a>"</span>
-00028 
-00029 <span class="preprocessor">#if APR_HAVE_STRUCT_RLIMIT</span>
-00030 <span class="preprocessor"></span><span class="preprocessor">#include &lt;sys/time.h&gt;</span>
-00031 <span class="preprocessor">#include &lt;sys/resource.h&gt;</span>
-00032 <span class="preprocessor">#endif</span>
-00033 <span class="preprocessor"></span>
-00034 <span class="preprocessor">#ifdef __cplusplus</span>
-00035 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
-00036 <span class="preprocessor">#endif </span><span class="comment">/* __cplusplus */</span>
-00037 <span class="comment"></span>
-00038 <span class="comment">/**</span>
-00039 <span class="comment"> * @defgroup apr_thread_proc Threads and Process Functions</span>
-00040 <span class="comment"> * @ingroup APR </span>
-00041 <span class="comment"> * @{</span>
-00042 <span class="comment"> */</span>
-00043 
-<a name="l00044"></a><a class="code" href="group__apr__thread__proc.html#ga66">00044</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
-00045     <a class="code" href="group__apr__thread__proc.html#gga66a29">APR_SHELLCMD</a>,           <span class="comment">/**&lt; use the shell to invoke the program */</span>
-00046     <a class="code" href="group__apr__thread__proc.html#gga66a30">APR_PROGRAM</a>,            <span class="comment">/**&lt; invoke the program directly, no copied env */</span>
-00047     <a class="code" href="group__apr__thread__proc.html#gga66a31">APR_PROGRAM_ENV</a>,        <span class="comment">/**&lt; invoke the program, replicating our environment */</span>
-00048     <a class="code" href="group__apr__thread__proc.html#gga66a32">APR_PROGRAM_PATH</a>,       <span class="comment">/**&lt; find program on PATH, use our environment */</span>
-00049     <a class="code" href="group__apr__thread__proc.html#gga66a33">APR_SHELLCMD_ENV</a>        <span class="comment">/**&lt; use the shell to invoke the program,</span>
-00050 <span class="comment">                             *   replicating our environment</span>
-00051 <span class="comment">                             */</span>
-00052 } <a class="code" href="group__apr__thread__proc.html#ga66">apr_cmdtype_e</a>;
-00053 
-<a name="l00054"></a><a class="code" href="group__apr__thread__proc.html#ga67">00054</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
-00055     <a class="code" href="group__apr__thread__proc.html#gga67a34">APR_WAIT</a>,           <span class="comment">/**&lt; wait for the specified process to finish */</span>
-00056     <a class="code" href="group__apr__thread__proc.html#gga67a35">APR_NOWAIT</a>          <span class="comment">/**&lt; do not wait -- just see if it has finished */</span>
-00057 } <a class="code" href="group__apr__thread__proc.html#ga67">apr_wait_how_e</a>;
-00058 
-00059 <span class="comment">/* I am specifically calling out the values so that the macros below make</span>
-00060 <span class="comment"> * more sense.  Yes, I know I don't need to, but I am hoping this makes what</span>
-00061 <span class="comment"> * I am doing more clear.  If you want to add more reasons to exit, continue</span>
-00062 <span class="comment"> * to use bitmasks.</span>
-00063 <span class="comment"> */</span>
-<a name="l00064"></a><a class="code" href="group__apr__thread__proc.html#ga68">00064</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
-00065     <a class="code" href="group__apr__thread__proc.html#gga68a36">APR_PROC_EXIT</a> = 1,          <span class="comment">/**&lt; process exited normally */</span>
-00066     <a class="code" href="group__apr__thread__proc.html#gga68a37">APR_PROC_SIGNAL</a> = 2,        <span class="comment">/**&lt; process exited due to a signal */</span>
-00067     <a class="code" href="group__apr__thread__proc.html#gga68a38">APR_PROC_SIGNAL_CORE</a> = 4    <span class="comment">/**&lt; process exited and dumped a core file */</span>
-00068 } <a class="code" href="group__apr__thread__proc.html#ga68">apr_exit_why_e</a>;
-00069 <span class="comment"></span>
-00070 <span class="comment">/** did we exit the process */</span>
-<a name="l00071"></a><a class="code" href="group__apr__thread__proc.html#ga52">00071</a> <span class="preprocessor">#define APR_PROC_CHECK_EXIT(x)        (x &amp; APR_PROC_EXIT)</span>
-00072 <span class="preprocessor"></span><span class="comment">/** did we get a signal */</span>
-<a name="l00073"></a><a class="code" href="group__apr__thread__proc.html#ga53">00073</a> <span class="preprocessor">#define APR_PROC_CHECK_SIGNALED(x)    (x &amp; APR_PROC_SIGNAL)</span>
-00074 <span class="preprocessor"></span><span class="comment">/** did we get core */</span>
-<a name="l00075"></a><a class="code" href="group__apr__thread__proc.html#ga54">00075</a> <span class="preprocessor">#define APR_PROC_CHECK_CORE_DUMP(x)   (x &amp; APR_PROC_SIGNAL_CORE)</span>
-00076 <span class="preprocessor"></span><span class="comment"></span>
-00077 <span class="comment">/** @see apr_procattr_io_set */</span>
-<a name="l00078"></a><a class="code" href="group__apr__thread__proc.html#ga55">00078</a> <span class="preprocessor">#define APR_NO_PIPE          0</span>
-00079 <span class="preprocessor"></span><span class="comment"></span>
-00080 <span class="comment">/** @see apr_procattr_io_set */</span>
-<a name="l00081"></a><a class="code" href="group__apr__thread__proc.html#ga56">00081</a> <span class="preprocessor">#define APR_FULL_BLOCK       1</span>
-00082 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_io_set */</span>
-<a name="l00083"></a><a class="code" href="group__apr__thread__proc.html#ga57">00083</a> <span class="preprocessor">#define APR_FULL_NONBLOCK    2</span>
-00084 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_io_set */</span>
-<a name="l00085"></a><a class="code" href="group__apr__thread__proc.html#ga58">00085</a> <span class="preprocessor">#define APR_PARENT_BLOCK     3</span>
-00086 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_io_set */</span>
-<a name="l00087"></a><a class="code" href="group__apr__thread__proc.html#ga59">00087</a> <span class="preprocessor">#define APR_CHILD_BLOCK      4</span>
-00088 <span class="preprocessor"></span><span class="comment"></span>
-00089 <span class="comment">/** @see apr_procattr_limit_set */</span>
-<a name="l00090"></a><a class="code" href="group__apr__thread__proc.html#ga60">00090</a> <span class="preprocessor">#define APR_LIMIT_CPU        0</span>
-00091 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_limit_set */</span>
-<a name="l00092"></a><a class="code" href="group__apr__thread__proc.html#ga61">00092</a> <span class="preprocessor">#define APR_LIMIT_MEM        1</span>
-00093 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_limit_set */</span>
-<a name="l00094"></a><a class="code" href="group__apr__thread__proc.html#ga62">00094</a> <span class="preprocessor">#define APR_LIMIT_NPROC      2</span>
-00095 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_limit_set */</span>
-<a name="l00096"></a><a class="code" href="group__apr__thread__proc.html#ga63">00096</a> <span class="preprocessor">#define APR_LIMIT_NOFILE     3</span>
-00097 <span class="preprocessor"></span><span class="comment"></span>
-00098 <span class="comment">/**</span>
-00099 <span class="comment"> * @defgroup APR_OC Other Child Flags</span>
-00100 <span class="comment"> * @{</span>
-00101 <span class="comment"> */</span>
-<a name="l00102"></a><a class="code" href="group___a_p_r___o_c.html#ga0">00102</a> <span class="preprocessor">#define APR_OC_REASON_DEATH         0     </span><span class="comment">/**&lt; child has died, caller must call</span>
-00103 <span class="comment">                                           * unregister still */</span>
-<a name="l00104"></a><a class="code" href="group___a_p_r___o_c.html#ga1">00104</a> <span class="preprocessor">#define APR_OC_REASON_UNWRITABLE    1     </span><span class="comment">/**&lt; write_fd is unwritable */</span>
-<a name="l00105"></a><a class="code" href="group___a_p_r___o_c.html#ga2">00105</a> <span class="preprocessor">#define APR_OC_REASON_RESTART       2     </span><span class="comment">/**&lt; a restart is occuring, perform</span>
-00106 <span class="comment">                                           * any necessary cleanup (including</span>
-00107 <span class="comment">                                           * sending a special signal to child)</span>
-00108 <span class="comment">                                           */</span>
-<a name="l00109"></a><a class="code" href="group___a_p_r___o_c.html#ga3">00109</a> <span class="preprocessor">#define APR_OC_REASON_UNREGISTER    3     </span><span class="comment">/**&lt; unregister has been called, do</span>
-00110 <span class="comment">                                           * whatever is necessary (including</span>
-00111 <span class="comment">                                           * kill the child) */</span>
-<a name="l00112"></a><a class="code" href="group___a_p_r___o_c.html#ga4">00112</a> <span class="preprocessor">#define APR_OC_REASON_LOST          4     </span><span class="comment">/**&lt; somehow the child exited without</span>
-00113 <span class="comment">                                           * us knowing ... buggy os? */</span>
-<a name="l00114"></a><a class="code" href="group___a_p_r___o_c.html#ga5">00114</a> <span class="preprocessor">#define APR_OC_REASON_RUNNING       5     </span><span class="comment">/**&lt; a health check is occuring, </span>
-00115 <span class="comment">                                           * for most maintainence functions</span>
-00116 <span class="comment">                                           * this is a no-op.</span>
-00117 <span class="comment">                                           */</span>
-00118 <span class="comment">/** @} */</span>
-00119 <span class="comment"></span>
-00120 <span class="comment">/** The APR process type */</span>
-<a name="l00121"></a><a class="code" href="structapr__proc__t.html">00121</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structapr__proc__t.html">apr_proc_t</a> {<span class="comment"></span>
-00122 <span class="comment">    /** The process ID */</span>
-<a name="l00123"></a><a class="code" href="structapr__proc__t.html#o0">00123</a>     pid_t <a class="code" href="structapr__proc__t.html#o0">pid</a>;<span class="comment"></span>
-00124 <span class="comment">    /** Parent's side of pipe to child's stdin */</span>
-<a name="l00125"></a><a class="code" href="structapr__proc__t.html#o1">00125</a>     <a class="code" href="group__apr__file__io.html#ga2">apr_file_t</a> *<a class="code" href="structapr__proc__t.html#o1">in</a>;<span class="comment"></span>
-00126 <span class="comment">    /** Parent's side of pipe to child's stdout */</span>
-<a name="l00127"></a><a class="code" href="structapr__proc__t.html#o2">00127</a>     <a class="code" href="group__apr__file__io.html#ga2">apr_file_t</a> *<a class="code" href="structapr__proc__t.html#o2">out</a>;<span class="comment"></span>
-00128 <span class="comment">    /** Parent's side of pipe to child's stdouterr */</span>
-<a name="l00129"></a><a class="code" href="structapr__proc__t.html#o3">00129</a>     <a class="code" href="group__apr__file__io.html#ga2">apr_file_t</a> *<a class="code" href="structapr__proc__t.html#o3">err</a>;
-00130 <span class="preprocessor">#if APR_HAS_PROC_INVOKED || defined(DOXYGEN)</span>
-00131 <span class="preprocessor"></span><span class="comment">    /** Diagnositics/debugging string of the command invoked for </span>
-00132 <span class="comment">     *  this process [only present if APR_HAS_PROC_INVOKED is true]</span>
-00133 <span class="comment">     * @remark Only enabled on Win32 by default.</span>
-00134 <span class="comment">     * @bug This should either always or never be present in release</span>
-00135 <span class="comment">     * builds - since it breaks binary compatibility.  We may enable</span>
-00136 <span class="comment">     * it always in APR 1.0 yet leave it undefined in most cases.</span>
-00137 <span class="comment">     */</span>
-<a name="l00138"></a><a class="code" href="structapr__proc__t.html#o4">00138</a>     <span class="keywordtype">char</span> *<a class="code" href="structapr__proc__t.html#o4">invoked</a>;
-00139 <span class="preprocessor">#endif</span>
-00140 <span class="preprocessor"></span><span class="preprocessor">#if defined(WIN32) || defined(DOXYGEN)</span>
-00141 <span class="preprocessor"></span><span class="comment">    /** (Win32 only) Creator's handle granting access to the process</span>
-00142 <span class="comment">     * @remark This handle is closed and reset to NULL in every case</span>
-00143 <span class="comment">     * corresponding to a waitpid() on Unix which returns the exit status.</span>
-00144 <span class="comment">     * Therefore Win32 correspond's to Unix's zombie reaping characteristics</span>
-00145 <span class="comment">     * and avoids potential handle leaks.</span>
-00146 <span class="comment">     */</span>
-<a name="l00147"></a><a class="code" href="structapr__proc__t.html#o5">00147</a>     HANDLE <a class="code" href="structapr__proc__t.html#o5">hproc</a>;
-00148 <span class="preprocessor">#endif</span>
-00149 <span class="preprocessor"></span>} <a class="code" href="structapr__proc__t.html">apr_proc_t</a>;
-00150 <span class="comment"></span>
-00151 <span class="comment">/**</span>
-00152 <span class="comment"> * The prototype for APR child errfn functions.  (See the description</span>
-00153 <span class="comment"> * of apr_procattr_child_errfn_set() for more information.)</span>
-00154 <span class="comment"> * It is passed the following parameters:</span>
-00155 <span class="comment"> * @param pool Pool associated with the apr_proc_t.  If your child</span>
-00156 <span class="comment"> *             error function needs user data, associate it with this</span>
-00157 <span class="comment"> *             pool.</span>
-00158 <span class="comment"> * @param err APR error code describing the error</span>
-00159 <span class="comment"> * @param description Text description of type of processing which failed</span>
-00160 <span class="comment"> */</span>
-<a name="l00161"></a><a class="code" href="group__apr__thread__proc.html#ga1">00161</a> <span class="keyword">typedef</span> void (<a class="code" href="group__apr__thread__proc.html#ga1">apr_child_errfn_t</a>)(<a class="code" href="group__apr__pools.html#ga0">apr_pool_t</a> *proc, <a class="code" href="group__apr__errno.html#ga0">apr_status_t</a> err,
-00162                                  <span class="keyword">const</span> <span class="keywordtype">char</span> *description);
-00163 <span class="comment"></span>
-00164 <span class="comment">/** Opaque Thread structure. */</span>
-<a name="l00165"></a><a class="code" href="group__apr__thread__proc.html#ga2">00165</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__thread__proc.html#ga2">apr_thread_t</a>           <a class="code" href="group__apr__thread__proc.html#ga2">apr_thread_t</a>;
-00166 <span class="comment"></span>
-00167 <span class="comment">/** Opaque Thread attributes structure. */</span>
-<a name="l00168"></a><a class="code" href="group__apr__thread__proc.html#ga3">00168</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__thread__proc.html#ga3">apr_threadattr_t</a>       <a class="code" href="group__apr__thread__proc.html#ga3">apr_threadattr_t</a>;
-00169 <span class="comment"></span>
-00170 <span class="comment">/** Opaque Process attributes structure. */</span>
-<a name="l00171"></a><a class="code" href="group__apr__thread__proc.html#ga4">00171</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__thread__proc.html#ga4">apr_procattr_t</a>         <a class="code" href="group__apr__thread__proc.html#ga4">apr_procattr_t</a>;
-00172 <span class="comment"></span>
-00173 <span class="comment">/** Opaque control variable for one-time atomic variables.  */</span>
-<a name="l00174"></a><a class="code" href="group__apr__thread__proc.html#ga5">00174</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__thread__proc.html#ga5">apr_thread_once_t</a>      <a class="code" href="group__apr__thread__proc.html#ga5">apr_thread_once_t</a>;
-00175 <span class="comment"></span>
-00176 <span class="comment">/** Opaque thread private address space. */</span>
-<a name="l00177"></a><a class="code" href="group__apr__thread__proc.html#ga6">00177</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__thread__proc.html#ga6">apr_threadkey_t</a>        <a class="code" href="group__apr__thread__proc.html#ga6">apr_threadkey_t</a>;
-00178 <span class="comment"></span>
-00179 <span class="comment">/** Opaque record of child process. */</span>
-<a name="l00180"></a><a class="code" href="group__apr__thread__proc.html#ga7">00180</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__thread__proc.html#ga7">apr_other_child_rec_t</a>  <a class="code" href="group__apr__thread__proc.html#ga7">apr_other_child_rec_t</a>;
-00181 <span class="comment"></span>
-00182 <span class="comment">/**</span>
-00183 <span class="comment"> * The prototype for any APR thread worker functions.</span>
-00184 <span class="comment"> */</span>
-<a name="l00185"></a><a class="code" href="group__apr__thread__proc.html#ga8">00185</a> <span class="keyword">typedef</span> <span class="keywordtype">void</span> *(APR_THREAD_FUNC *<a class="code" href="group__apr__thread__proc.html#ga8">apr_thread_start_t</a>)(<a class="code" href="group__apr__thread__proc.html#ga2">apr_thread_t</a>*, <span class="keywordtype">void</span>*);
-00186 
-<a name="l00187"></a><a class="code" href="group__apr__thread__proc.html#ga69">00187</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
-00188     <a class="code" href="group__apr__thread__proc.html#gga69a39">APR_KILL_NEVER</a>,             <span class="comment">/**&lt; process is never sent any signals */</span>
-00189     <a class="code" href="group__apr__thread__proc.html#gga69a40">APR_KILL_ALWAYS</a>,            <span class="comment">/**&lt; process is sent SIGKILL on apr_pool_t cleanup */</span>
-00190     <a class="code" href="group__apr__thread__proc.html#gga69a41">APR_KILL_AFTER_TIMEOUT</a>,     <span class="comment">/**&lt; SIGTERM, wait 3 seconds, SIGKILL */</span>
-00191     <a class="code" href="group__apr__thread__proc.html#gga69a42">APR_JUST_WAIT</a>,              <span class="comment">/**&lt; wait forever for the process to complete */</span>
-00192     <a class="code" href="group__apr__thread__proc.html#gga69a43">APR_KILL_ONLY_ONCE</a>          <span class="comment">/**&lt; send SIGTERM and then wait */</span>
-00193 } <a class="code" href="group__apr__thread__proc.html#ga69">apr_kill_conditions_e</a>;
-00194 
-00195 <span class="comment">/* Thread Function definitions */</span>
-00196 
-00197 <span class="preprocessor">#if APR_HAS_THREADS</span>
-00198 <span class="preprocessor"></span><span class="comment"></span>
-00199 <span class="comment">/**</span>
-00200 <span class="comment"> * Create and initialize a new threadattr variable</span>
-00201 <span class="comment"> * @param new_attr The newly created threadattr.</span>
-00202 <span class="comment"> * @param cont The pool to use</span>
-00203 <span class="comment"> */</span>
-00204 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_threadattr_create(apr_threadattr_t **new_attr, 
-00205                                                 <a class="code" href="group__apr__pools.html#ga0">apr_pool_t</a> *cont);
-00206 <span class="comment"></span>
-00207 <span class="comment">/**</span>
-00208 <span class="comment"> * Set if newly created threads should be created in detached state.</span>
-00209 <span class="comment"> * @param attr The threadattr to affect </span>
-00210 <span class="comment"> * @param on Non-zero if detached threads should be created.</span>
-00211 <span class="comment"> */</span>
-00212 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_threadattr_detach_set(apr_threadattr_t *attr, 
-00213                                                     apr_int32_t on);
-00214 <span class="comment"></span>
-00215 <span class="comment">/**</span>
-00216 <span class="comment"> * Get the detach state for this threadattr.</span>
-00217 <span class="comment"> * @param attr The threadattr to reference</span>
-00218 <span class="comment"> * @return APR_DETACH if threads are to be detached, or APR_NOTDETACH</span>
-00219 <span class="comment"> * if threads are to be joinable. </span>
-00220 <span class="comment"> */</span>
-00221 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_threadattr_detach_get(apr_threadattr_t *attr);
-00222 <span class="comment"></span>
-00223 <span class="comment">/**</span>
-00224 <span class="comment"> * Set the stack size of newly created threads.</span>
-00225 <span class="comment"> * @param attr The threadattr to affect </span>
-00226 <span class="comment"> * @param stacksize The stack size in bytes</span>
-00227 <span class="comment"> */</span>
-00228 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_threadattr_stacksize_set(apr_threadattr_t *attr,
-00229                                                        apr_size_t stacksize);
-00230 <span class="comment"></span>
-00231 <span class="comment">/**</span>
-00232 <span class="comment"> * Set the stack guard area size of newly created threads.</span>
-00233 <span class="comment"> * @param attr The threadattr to affect </span>
-00234 <span class="comment"> * @param guardsize The stack guard area size in bytes</span>
-00235 <span class="comment"> * @note Thread library implementations commonly use a "guard area"</span>
-00236 <span class="comment"> * after each thread's stack which is not readable or writable such that</span>
-00237 <span class="comment"> * stack overflows cause a segfault; this consumes e.g. 4K of memory</span>
-00238 <span class="comment"> * and increases memory management overhead.  Setting the guard area</span>
-00239 <span class="comment"> * size to zero hence trades off reliable behaviour on stack overflow</span>
-00240 <span class="comment"> * for performance. */</span>
-00241 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
-00242                                                        apr_size_t guardsize);
-00243 <span class="comment"></span>
-00244 <span class="comment">/**</span>
-00245 <span class="comment"> * Create a new thread of execution</span>
-00246 <span class="comment"> * @param new_thread The newly created thread handle.</span>
-00247 <span class="comment"> * @param attr The threadattr to use to determine how to create the thread</span>
-00248 <span class="comment"> * @param func The function to start the new thread in</span>
-00249 <span class="comment"> * @param data Any data to be passed to the starting function</span>
-00250 <span class="comment"> * @param cont The pool to use</span>
-00251 <span class="comment"> */</span>
-00252 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_thread_create(apr_thread_t **new_thread, 
-00253                                             apr_threadattr_t *attr, 
-00254                                             <a class="code" href="group__apr__thread__proc.html#ga8">apr_thread_start_t</a> func, 
-00255                                             <span class="keywordtype">void</span> *data, <a class="code" href="group__apr__pools.html#ga0">apr_pool_t</a> *cont);
-00256 <span class="comment"></span>
-00257 <span class="comment">/**</span>
-00258 <span class="comment"> * stop the current thread</span>
-00259 <span class="comment"> * @param thd The thread to stop</span>
-00260 <span class="comment"> * @param retval The return value to pass back to any thread that cares</span>
-00261 <span class="comment"> */</span>
-00262 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_thread_exit(apr_thread_t *thd, 
-00263                                           <a class="code" href="group__apr__errno.html#ga0">apr_status_t</a> retval);
-00264 <span class="comment"></span>
-00265 <span class="comment">/**</span>
-00266 <span class="comment"> * block until the desired thread stops executing.</span>
-00267 <span class="comment"> * @param retval The return value from the dead thread.</span>
-00268 <span class="comment"> * @param thd The thread to join</span>
-00269 <span class="comment"> */</span>
-00270 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_thread_join(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a> *retval, 
-00271                                           apr_thread_t *thd); 
-00272 <span class="comment"></span>
-00273 <span class="comment">/**</span>
-00274 <span class="comment"> * force the current thread to yield the processor</span>
-00275 <span class="comment"> */</span>
-00276 APR_DECLARE(<span class="keywordtype">void</span>) apr_thread_yield(<span class="keywordtype">void</span>);
-00277 <span class="comment"></span>
-00278 <span class="comment">/**</span>
-00279 <span class="comment"> * Initialize the control variable for apr_thread_once.  If this isn't</span>
-00280 <span class="comment"> * called, apr_initialize won't work.</span>
-00281 <span class="comment"> * @param control The control variable to initialize</span>
-00282 <span class="comment"> * @param p The pool to allocate data from.</span>
-00283 <span class="comment"> */</span>
-00284 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_thread_once_init(apr_thread_once_t **control,
-00285                                                <a class="code" href="group__apr__pools.html#ga0">apr_pool_t</a> *p);
-00286 <span class="comment"></span>
-00287 <span class="comment">/**</span>
-00288 <span class="comment"> * Run the specified function one time, regardless of how many threads</span>
-00289 <span class="comment"> * call it.</span>
-00290 <span class="comment"> * @param control The control variable.  The same variable should</span>
-00291 <span class="comment"> *                be passed in each time the function is tried to be</span>
-00292 <span class="comment"> *                called.  This is how the underlying functions determine</span>
-00293 <span class="comment"> *                if the function has ever been called before.</span>
-00294 <span class="comment"> * @param func The function to call.</span>
-00295 <span class="comment"> */</span>
-00296 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_thread_once(apr_thread_once_t *control,
-00297                                           <span class="keywordtype">void</span> (*func)(<span class="keywordtype">void</span>));
-00298 <span class="comment"></span>
-00299 <span class="comment">/**</span>
-00300 <span class="comment"> * detach a thread</span>
-00301 <span class="comment"> * @param thd The thread to detach </span>
-00302 <span class="comment"> */</span>
-00303 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_thread_detach(apr_thread_t *thd);
-00304 <span class="comment"></span>
-00305 <span class="comment">/**</span>
-00306 <span class="comment"> * Return the pool associated with the current thread.</span>
-00307 <span class="comment"> * @param data The user data associated with the thread.</span>
-00308 <span class="comment"> * @param key The key to associate with the data</span>
-00309 <span class="comment"> * @param thread The currently open thread.</span>
-00310 <span class="comment"> */</span>
-00311 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_thread_data_get(<span class="keywordtype">void</span> **data, const <span class="keywordtype">char</span> *key,
-00312                                              apr_thread_t *thread);
-00313 <span class="comment"></span>
-00314 <span class="comment">/**</span>
-00315 <span class="comment"> * Return the pool associated with the current thread.</span>
-00316 <span class="comment"> * @param data The user data to associate with the thread.</span>
-00317 <span class="comment"> * @param key The key to use for associating the data with the tread</span>
-00318 <span class="comment"> * @param cleanup The cleanup routine to use when the thread is destroyed.</span>
-00319 <span class="comment"> * @param thread The currently open thread.</span>
-00320 <span class="comment"> */</span>
-00321 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_thread_data_set(<span class="keywordtype">void</span> *data, const <span class="keywordtype">char</span> *key,
-00322                                              <a class="code" href="group__apr__errno.html#ga0">apr_status_t</a> (*cleanup) (<span class="keywordtype">void</span> *),
-00323                                              apr_thread_t *thread);
-00324 <span class="comment"></span>
-00325 <span class="comment">/**</span>
-00326 <span class="comment"> * Create and initialize a new thread private address space</span>
-00327 <span class="comment"> * @param key The thread private handle.</span>
-00328 <span class="comment"> * @param dest The destructor to use when freeing the private memory.</span>
-00329 <span class="comment"> * @param cont The pool to use</span>
-00330 <span class="comment"> */</span>
-00331 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_threadkey_private_create(apr_threadkey_t **key, 
-00332                                                     <span class="keywordtype">void</span> (*dest)(<span class="keywordtype">void</span> *),
-00333                                                     <a class="code" href="group__apr__pools.html#ga0">apr_pool_t</a> *cont);
-00334 <span class="comment"></span>
-00335 <span class="comment">/**</span>
-00336 <span class="comment"> * Get a pointer to the thread private memory</span>
-00337 <span class="comment"> * @param new_mem The data stored in private memory </span>
-00338 <span class="comment"> * @param key The handle for the desired thread private memory </span>
-00339 <span class="comment"> */</span>
-00340 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_threadkey_private_get(<span class="keywordtype">void</span> **new_mem, 
-00341                                                  apr_threadkey_t *key);
-00342 <span class="comment"></span>
-00343 <span class="comment">/**</span>
-00344 <span class="comment"> * Set the data to be stored in thread private memory</span>
-00345 <span class="comment"> * @param priv The data to be stored in private memory </span>
-00346 <span class="comment"> * @param key The handle for the desired thread private memory </span>
-00347 <span class="comment"> */</span>
-00348 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_threadkey_private_set(<span class="keywordtype">void</span> *priv, 
-00349                                                  apr_threadkey_t *key);
-00350 <span class="comment"></span>
-00351 <span class="comment">/**</span>
-00352 <span class="comment"> * Free the thread private memory</span>
-00353 <span class="comment"> * @param key The handle for the desired thread private memory </span>
-00354 <span class="comment"> */</span>
-00355 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_threadkey_private_delete(apr_threadkey_t *key);
-00356 <span class="comment"></span>
-00357 <span class="comment">/**</span>
-00358 <span class="comment"> * Return the pool associated with the current threadkey.</span>
-00359 <span class="comment"> * @param data The user data associated with the threadkey.</span>
-00360 <span class="comment"> * @param key The key associated with the data</span>
-00361 <span class="comment"> * @param threadkey The currently open threadkey.</span>
-00362 <span class="comment"> */</span>
-00363 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_threadkey_data_get(<span class="keywordtype">void</span> **data, const <span class="keywordtype">char</span> *key,
-00364                                                 apr_threadkey_t *threadkey);
-00365 <span class="comment"></span>
-00366 <span class="comment">/**</span>
-00367 <span class="comment"> * Return the pool associated with the current threadkey.</span>
-00368 <span class="comment"> * @param data The data to set.</span>
-00369 <span class="comment"> * @param key The key to associate with the data.</span>
-00370 <span class="comment"> * @param cleanup The cleanup routine to use when the file is destroyed.</span>
-00371 <span class="comment"> * @param threadkey The currently open threadkey.</span>
-00372 <span class="comment"> */</span>
-00373 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_threadkey_data_set(<span class="keywordtype">void</span> *data, const <span class="keywordtype">char</span> *key,
-00374                                                 <a class="code" href="group__apr__errno.html#ga0">apr_status_t</a> (*cleanup) (<span class="keywordtype">void</span> *),
-00375                                                 apr_threadkey_t *threadkey);
-00376 
-00377 #endif
-00378 <span class="comment"></span>
-00379 <span class="comment">/**</span>
-00380 <span class="comment"> * Create and initialize a new procattr variable</span>
-00381 <span class="comment"> * @param new_attr The newly created procattr. </span>
-00382 <span class="comment"> * @param cont The pool to use</span>
-00383 <span class="comment"> */</span>
-00384 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_procattr_create(apr_procattr_t **new_attr,
-00385                                                   <a class="code" href="group__apr__pools.html#ga0">apr_pool_t</a> *cont);
-00386 <span class="comment"></span>
-00387 <span class="comment">/**</span>
-00388 <span class="comment"> * Determine if any of stdin, stdout, or stderr should be linked to pipes </span>
-00389 <span class="comment"> * when starting a child process.</span>
-00390 <span class="comment"> * @param attr The procattr we care about. </span>
-00391 <span class="comment"> * @param in Should stdin be a pipe back to the parent?</span>
-00392 <span class="comment"> * @param out Should stdout be a pipe back to the parent?</span>
-00393 <span class="comment"> * @param err Should stderr be a pipe back to the parent?</span>
-00394 <span class="comment"> */</span>
-00395 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_procattr_io_set(apr_procattr_t *attr, 
-00396                                              apr_int32_t in, apr_int32_t out,
-00397                                              apr_int32_t err);
-00398 <span class="comment"></span>
-00399 <span class="comment">/**</span>
-00400 <span class="comment"> * Set the child_in and/or parent_in values to existing apr_file_t values.</span>
-00401 <span class="comment"> * @param attr The procattr we care about. </span>
-00402 <span class="comment"> * @param child_in apr_file_t value to use as child_in. Must be a valid file.</span>
-00403 <span class="comment"> * @param parent_in apr_file_t value to use as parent_in. Must be a valid file.</span>
-00404 <span class="comment"> * @remark  This is NOT a required initializer function. This is</span>
-00405 <span class="comment"> *          useful if you have already opened a pipe (or multiple files)</span>
-00406 <span class="comment"> *          that you wish to use, perhaps persistently across multiple</span>
-00407 <span class="comment"> *          process invocations - such as a log file. You can save some </span>
-00408 <span class="comment"> *          extra function calls by not creating your own pipe since this</span>
-00409 <span class="comment"> *          creates one in the process space for you.</span>
-00410 <span class="comment"> */</span>
-00411 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_procattr_child_in_set(struct apr_procattr_t *attr,
-00412                                                   <a class="code" href="group__apr__file__io.html#ga2">apr_file_t</a> *child_in,
-00413                                                   <a class="code" href="group__apr__file__io.html#ga2">apr_file_t</a> *parent_in);
-00414 <span class="comment"></span>
-00415 <span class="comment">/**</span>
-00416 <span class="comment"> * Set the child_out and parent_out values to existing apr_file_t values.</span>
-00417 <span class="comment"> * @param attr The procattr we care about. </span>
-00418 <span class="comment"> * @param child_out apr_file_t value to use as child_out. Must be a valid file.</span>
-00419 <span class="comment"> * @param parent_out apr_file_t value to use as parent_out. Must be a valid file.</span>
-00420 <span class="comment"> * @remark This is NOT a required initializer function. This is</span>
-00421 <span class="comment"> *         useful if you have already opened a pipe (or multiple files)</span>
-00422 <span class="comment"> *         that you wish to use, perhaps persistently across multiple</span>
-00423 <span class="comment"> *         process invocations - such as a log file. </span>
-00424 <span class="comment"> */</span>
-00425 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_procattr_child_out_set(struct apr_procattr_t *attr,
-00426                                                    <a class="code" href="group__apr__file__io.html#ga2">apr_file_t</a> *child_out,
-00427                                                    <a class="code" href="group__apr__file__io.html#ga2">apr_file_t</a> *parent_out);
-00428 <span class="comment"></span>
-00429 <span class="comment">/**</span>
-00430 <span class="comment"> * Set the child_err and parent_err values to existing apr_file_t values.</span>
-00431 <span class="comment"> * @param attr The procattr we care about. </span>
-00432 <span class="comment"> * @param child_err apr_file_t value to use as child_err. Must be a valid file.</span>
-00433 <span class="comment"> * @param parent_err apr_file_t value to use as parent_err. Must be a valid file.</span>
-00434 <span class="comment"> * @remark This is NOT a required initializer function. This is</span>
-00435 <span class="comment"> *         useful if you have already opened a pipe (or multiple files)</span>
-00436 <span class="comment"> *         that you wish to use, perhaps persistently across multiple</span>
-00437 <span class="comment"> *         process invocations - such as a log file. </span>
-00438 <span class="comment"> */</span>
-00439 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_procattr_child_err_set(struct apr_procattr_t *attr,
-00440                                                    <a class="code" href="group__apr__file__io.html#ga2">apr_file_t</a> *child_err,
-00441                                                    <a class="code" href="group__apr__file__io.html#ga2">apr_file_t</a> *parent_err);
-00442 <span class="comment"></span>
-00443 <span class="comment">/**</span>
-00444 <span class="comment"> * Set which directory the child process should start executing in.</span>
-00445 <span class="comment"> * @param attr The procattr we care about. </span>
-00446 <span class="comment"> * @param dir Which dir to start in.  By default, this is the same dir as</span>
-00447 <span class="comment"> *            the parent currently resides in, when the createprocess call</span>
-00448 <span class="comment"> *            is made. </span>
-00449 <span class="comment"> */</span>
-00450 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_procattr_dir_set(apr_procattr_t *attr, 
-00451                                               const <span class="keywordtype">char</span> *dir);
-00452 <span class="comment"></span>
-00453 <span class="comment">/**</span>
-00454 <span class="comment"> * Set what type of command the child process will call.</span>
-00455 <span class="comment"> * @param attr The procattr we care about. </span>
-00456 <span class="comment"> * @param cmd The type of command.  One of:</span>
-00457 <span class="comment"> * &lt;PRE&gt;</span>
-00458 <span class="comment"> *            APR_SHELLCMD     --  Anything that the shell can handle</span>
-00459 <span class="comment"> *            APR_PROGRAM      --  Executable program   (default) </span>
-00460 <span class="comment"> *            APR_PROGRAM_ENV  --  Executable program, copy environment</span>
-00461 <span class="comment"> *            APR_PROGRAM_PATH --  Executable program on PATH, copy env</span>
-00462 <span class="comment"> * &lt;/PRE&gt;</span>
-00463 <span class="comment"> */</span>
-00464 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_procattr_cmdtype_set(apr_procattr_t *attr,
-00465                                                   apr_cmdtype_e cmd);
-00466 <span class="comment"></span>
-00467 <span class="comment">/**</span>
-00468 <span class="comment"> * Determine if the child should start in detached state.</span>
-00469 <span class="comment"> * @param attr The procattr we care about. </span>
-00470 <span class="comment"> * @param detach Should the child start in detached state?  Default is no. </span>
-00471 <span class="comment"> */</span>
-00472 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_procattr_detach_set(apr_procattr_t *attr, 
-00473                                                  apr_int32_t detach);
-00474 
-00475 #if APR_HAVE_STRUCT_RLIMIT<span class="comment"></span>
-00476 <span class="comment">/**</span>
-00477 <span class="comment"> * Set the Resource Utilization limits when starting a new process.</span>
-00478 <span class="comment"> * @param attr The procattr we care about. </span>
-00479 <span class="comment"> * @param what Which limit to set, one of:</span>
-00480 <span class="comment"> * &lt;PRE&gt;</span>
-00481 <span class="comment"> *                 APR_LIMIT_CPU</span>
-00482 <span class="comment"> *                 APR_LIMIT_MEM</span>
-00483 <span class="comment"> *                 APR_LIMIT_NPROC</span>
-00484 <span class="comment"> *                 APR_LIMIT_NOFILE</span>
-00485 <span class="comment"> * &lt;/PRE&gt;</span>
-00486 <span class="comment"> * @param limit Value to set the limit to.</span>
-00487 <span class="comment"> */</span>
-00488 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_procattr_limit_set(apr_procattr_t *attr, 
-00489                                                 apr_int32_t what,
-00490                                                 struct rlimit *limit);
-00491 #endif
-00492 <span class="comment"></span>
-00493 <span class="comment">/**</span>
-00494 <span class="comment"> * Specify an error function to be called in the child process if APR</span>
-00495 <span class="comment"> * encounters an error in the child prior to running the specified program.</span>
-00496 <span class="comment"> * @param attr The procattr describing the child process to be created.</span>
-00497 <span class="comment"> * @param errfn The function to call in the child process.</span>
-00498 <span class="comment"> * @remark At the present time, it will only be called from apr_proc_create()</span>
-00499 <span class="comment"> *         on platforms where fork() is used.  It will never be called on other</span>
-00500 <span class="comment"> *         platforms, on those platforms apr_proc_create() will return the error</span>
-00501 <span class="comment"> *         in the parent process rather than invoke the callback in the now-forked</span>
-00502 <span class="comment"> *         child process.</span>
-00503 <span class="comment"> */</span>
-00504 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_procattr_child_errfn_set(apr_procattr_t *attr,
-00505                                                        <a class="code" href="group__apr__thread__proc.html#ga1">apr_child_errfn_t</a> *errfn);
-00506 <span class="comment"></span>
-00507 <span class="comment">/**</span>
-00508 <span class="comment"> * Specify that apr_proc_create() should do whatever it can to report</span>
-00509 <span class="comment"> * failures to the caller of apr_proc_create(), rather than find out in</span>
-00510 <span class="comment"> * the child.</span>
-00511 <span class="comment"> * @param attr The procattr describing the child process to be created.</span>
-00512 <span class="comment"> * @param chk Flag to indicate whether or not extra work should be done</span>
-00513 <span class="comment"> *            to try to report failures to the caller.</span>
-00514 <span class="comment"> * @remark This flag only affects apr_proc_create() on platforms where</span>
-00515 <span class="comment"> *         fork() is used.  This leads to extra overhead in the calling</span>
-00516 <span class="comment"> *         process, but that may help the application handle such</span>
-00517 <span class="comment"> *         errors more gracefully.</span>
-00518 <span class="comment"> */</span>
-00519 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_procattr_error_check_set(apr_procattr_t *attr,
-00520                                                        apr_int32_t chk);
-00521 <span class="comment"></span>
-00522 <span class="comment">/**</span>
-00523 <span class="comment"> * Determine if the child should start in its own address space or using the </span>
-00524 <span class="comment"> * current one from its parent</span>
-00525 <span class="comment"> * @param attr The procattr we care about. </span>
-00526 <span class="comment"> * @param addrspace Should the child start in its own address space?  Default</span>
-00527 <span class="comment"> *                  is no on NetWare and yes on other platforms.</span>
-00528 <span class="comment"> */</span>
-00529 APR_DECLARE(<a class="code" href="group__apr__errno.html#ga0">apr_status_t</a>) apr_procattr_addrspace_set(apr_procattr_t *attr,
-00530                                                        apr_int32_t addrspace);
-00531 
-00532 #if APR_HAS_FORK<span class="comment"></span>
+<h1>apr_thread_proc.h</h1><a href="apr__thread__proc_8h.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as</span>
+00002 <span class="comment"> * applicable.</span>
+00003 <span class="comment"> *</span>
+00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span>
+00005 <span class="comment"> * you may not use this file except in compliance with the License.</span>
+00006 <span class="comment"> * You may obtain a copy of the License at</span>
+00007 <span class="comment"> *</span>
+00008 <span class="comment"> *     http://www.apache.org/licenses/LICENSE-2.0</span>
+00009 <span class="comment"> *</span>
+00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
+00011 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span>
+00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
+00013 <span class="comment"> * See the License for the specific language governing permissions and</span>
+00014 <span class="comment"> * limitations under the License.</span>
+00015 <span class="comment"> */</span>
+00016 
+00017 <span class="preprocessor">#ifndef APR_THREAD_PROC_H</span>
+00018 <span class="preprocessor"></span><span class="preprocessor">#define APR_THREAD_PROC_H</span>
+00019 <span class="preprocessor"></span><span class="comment"></span>
+00020 <span class="comment">/**</span>
+00021 <span class="comment"> * @file apr_thread_proc.h</span>
+00022 <span class="comment"> * @brief APR Thread and Process Library</span>
+00023 <span class="comment"> */</span>
+00024 
+00025 <span class="preprocessor">#include "apr.h"</span>
+00026 <span class="preprocessor">#include "<a class="code" href="apr__file__io_8h.html">apr_file_io.h</a>"</span>
+00027 <span class="preprocessor">#include "<a class="code" href="apr__pools_8h.html">apr_pools.h</a>"</span>
+00028 <span class="preprocessor">#include "<a class="code" href="apr__errno_8h.html">apr_errno.h</a>"</span>
+00029 
+00030 <span class="preprocessor">#if APR_HAVE_STRUCT_RLIMIT</span>
+00031 <span class="preprocessor"></span><span class="preprocessor">#include &lt;sys/time.h&gt;</span>
+00032 <span class="preprocessor">#include &lt;sys/resource.h&gt;</span>
+00033 <span class="preprocessor">#endif</span>
+00034 <span class="preprocessor"></span>
+00035 <span class="preprocessor">#ifdef __cplusplus</span>
+00036 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
+00037 <span class="preprocessor">#endif </span><span class="comment">/* __cplusplus */</span>
+00038 <span class="comment"></span>
+00039 <span class="comment">/**</span>
+00040 <span class="comment"> * @defgroup apr_thread_proc Threads and Process Functions</span>
+00041 <span class="comment"> * @ingroup APR </span>
+00042 <span class="comment"> * @{</span>
+00043 <span class="comment"> */</span>
+00044 
+<a name="l00045"></a><a class="code" href="group__apr__thread__proc.html#ga68">00045</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00046     <a class="code" href="group__apr__thread__proc.html#gga68a29">APR_SHELLCMD</a>,           <span class="comment">/**&lt; use the shell to invoke the program */</span>
+00047     <a class="code" href="group__apr__thread__proc.html#gga68a30">APR_PROGRAM</a>,            <span class="comment">/**&lt; invoke the program directly, no copied env */</span>
+00048     <a class="code" href="group__apr__thread__proc.html#gga68a31">APR_PROGRAM_ENV</a>,        <span class="comment">/**&lt; invoke the program, replicating our environment */</span>
+00049     <a class="code" href="group__apr__thread__proc.html#gga68a32">APR_PROGRAM_PATH</a>,       <span class="comment">/**&lt; find program on PATH, use our environment */</span>
+00050     <a class="code" href="group__apr__thread__proc.html#gga68a33">APR_SHELLCMD_ENV</a>        <span class="comment">/**&lt; use the shell to invoke the program,</span>
+00051 <span class="comment">                             *   replicating our environment</span>
+00052 <span class="comment">                             */</span>
+00053 } <a class="code" href="group__apr__thread__proc.html#ga68">apr_cmdtype_e</a>;
+00054 
+<a name="l00055"></a><a class="code" href="group__apr__thread__proc.html#ga69">00055</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00056     <a class="code" href="group__apr__thread__proc.html#gga69a34">APR_WAIT</a>,           <span class="comment">/**&lt; wait for the specified process to finish */</span>
+00057     <a class="code" href="group__apr__thread__proc.html#gga69a35">APR_NOWAIT</a>          <span class="comment">/**&lt; do not wait -- just see if it has finished */</span>
+00058 } <a class="code" href="group__apr__thread__proc.html#ga69">apr_wait_how_e</a>;
+00059 
+00060 <span class="comment">/* I am specifically calling out the values so that the macros below make</span>
+00061 <span class="comment"> * more sense.  Yes, I know I don't need to, but I am hoping this makes what</span>
+00062 <span class="comment"> * I am doing more clear.  If you want to add more reasons to exit, continue</span>
+00063 <span class="comment"> * to use bitmasks.</span>
+00064 <span class="comment"> */</span>
+<a name="l00065"></a><a class="code" href="group__apr__thread__proc.html#ga70">00065</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00066     <a class="code" href="group__apr__thread__proc.html#gga70a36">APR_PROC_EXIT</a> = 1,          <span class="comment">/**&lt; process exited normally */</span>
+00067     <a class="code" href="group__apr__thread__proc.html#gga70a37">APR_PROC_SIGNAL</a> = 2,        <span class="comment">/**&lt; process exited due to a signal */</span>
+00068     <a class="code" href="group__apr__thread__proc.html#gga70a38">APR_PROC_SIGNAL_CORE</a> = 4    <span class="comment">/**&lt; process exited and dumped a core file */</span>
+00069 } <a class="code" href="group__apr__thread__proc.html#ga70">apr_exit_why_e</a>;
+00070 <span class="comment"></span>
+00071 <span class="comment">/** did we exit the process */</span>
+<a name="l00072"></a><a class="code" href="group__apr__thread__proc.html#ga54">00072</a> <span class="preprocessor">#define APR_PROC_CHECK_EXIT(x)        (x &amp; APR_PROC_EXIT)</span>
+00073 <span class="preprocessor"></span><span class="comment">/** did we get a signal */</span>
+<a name="l00074"></a><a class="code" href="group__apr__thread__proc.html#ga55">00074</a> <span class="preprocessor">#define APR_PROC_CHECK_SIGNALED(x)    (x &amp; APR_PROC_SIGNAL)</span>
+00075 <span class="preprocessor"></span><span class="comment">/** did we get core */</span>
+<a name="l00076"></a><a class="code" href="group__apr__thread__proc.html#ga56">00076</a> <span class="preprocessor">#define APR_PROC_CHECK_CORE_DUMP(x)   (x &amp; APR_PROC_SIGNAL_CORE)</span>
+00077 <span class="preprocessor"></span><span class="comment"></span>
+00078 <span class="comment">/** @see apr_procattr_io_set */</span>
+<a name="l00079"></a><a class="code" href="group__apr__thread__proc.html#ga57">00079</a> <span class="preprocessor">#define APR_NO_PIPE          0</span>
+00080 <span class="preprocessor"></span><span class="comment"></span>
+00081 <span class="comment">/** @see apr_procattr_io_set */</span>
+<a name="l00082"></a><a class="code" href="group__apr__thread__proc.html#ga58">00082</a> <span class="preprocessor">#define APR_FULL_BLOCK       1</span>
+00083 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_io_set */</span>
+<a name="l00084"></a><a class="code" href="group__apr__thread__proc.html#ga59">00084</a> <span class="preprocessor">#define APR_FULL_NONBLOCK    2</span>
+00085 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_io_set */</span>
+<a name="l00086"></a><a class="code" href="group__apr__thread__proc.html#ga60">00086</a> <span class="preprocessor">#define APR_PARENT_BLOCK     3</span>
+00087 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_io_set */</span>
+<a name="l00088"></a><a class="code" href="group__apr__thread__proc.html#ga61">00088</a> <span class="preprocessor">#define APR_CHILD_BLOCK      4</span>
+00089 <span class="preprocessor"></span><span class="comment"></span>
+00090 <span class="comment">/** @see apr_procattr_limit_set */</span>
+<a name="l00091"></a><a class="code" href="group__apr__thread__proc.html#ga62">00091</a> <span class="preprocessor">#define APR_LIMIT_CPU        0</span>
+00092 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_limit_set */</span>
+<a name="l00093"></a><a class="code" href="group__apr__thread__proc.html#ga63">00093</a> <span class="preprocessor">#define APR_LIMIT_MEM        1</span>
+00094 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_limit_set */</span>
+<a name="l00095"></a><a class="code" href="group__apr__thread__proc.html#ga64">00095</a> <span class="preprocessor">#define APR_LIMIT_NPROC      2</span>
+00096 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_limit_set */</span>
+<a name="l00097"></a><a class="code" href="group__apr__thread__proc.html#ga65">00097</a> <span class="preprocessor">#define APR_LIMIT_NOFILE     3</span>
+00098 <span class="preprocessor"></span><span class="comment"></span>
+00099 <span class="comment">/**</span>
+00100 <span class="comment"> * @defgroup APR_OC Other Child Flags</span>
+00101 <span class="comment"> * @{</span>
+00102 <span class="comment"> */</span>
+<a name="l00103"></a><a class="code" href="group___a_p_r___o_c.html#ga0">00103</a> <span class="preprocessor">#define APR_OC_REASON_DEATH         0     </span><span class="comment">/**&lt; child has died, caller must call</span>
+00104 <span class="comment">                                           * unregister still */</span>
+<a name="l00105"></a><a class="code" href="group___a_p_r___o_c.html#ga1">00105</a> <span class="preprocessor">#define APR_OC_REASON_UNWRITABLE    1     </span><span class="comment">/**&lt; write_fd is unwritable */</span>
+<a name="l00106"></a><a class="code" href="group___a_p_r___o_c.html#ga2">00106</a> <span class="preprocessor">#define APR_OC_REASON_RESTART       2     </span><span class="comment">/**&lt; a restart is occuring, perform</span>
+00107 <span class="comment">                                           * any necessary cleanup (including</span>
+00108 <span class="comment">                                           * sending a special signal to child)</span>
+00109 <span class="comment">                                           */</span>
+<a name="l00110"></a><a class="code" href="group___a_p_r___o_c.html#ga3">00110</a> <span class="preprocessor">#define APR_OC_REASON_UNREGISTER    3     </span><span class="comment">/**&lt; unregister has been called, do</span>
+00111 <span class="comment">                                           * whatever is necessary (including</span>
+00112 <span class="comment">                                           * kill the child) */</span>
+<a name="l00113"></a><a class="code" href="group___a_p_r___o_c.html#ga4">00113</a> <span class="preprocessor">#define APR_OC_REASON_LOST          4     </span><span class="comment">/**&lt; somehow the child exited without</span>
+00114 <span class="comment">                                           * us knowing ... buggy os? */</span>
+<a name="l00115"></a><a class="code" href="group___a_p_r___o_c.html#ga5">00115</a> <span class="preprocessor">#define APR_OC_REASON_RUNNING       5     </span><span class="comment">/**&lt; a health check is occuring, </span>
+00116 <span class="comment">                                           * for most maintainence functions</span>
+00117 <span class="comment">                                           * this is a no-op.</span>
+00118 <span class="comment">                                           */</span>
+00119 <span class="comment">/** @} */</span>
+00120 <span class="comment"></span>
+00121 <span class="comment">/** The APR process type */</span>
+<a name="l00122"></a><a class="code" href="structapr__proc__t.html">00122</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structapr__proc__t.html">apr_proc_t</a> {<span class="comment"></span>
+00123 <span class="comment">    /** The process ID */</span>
+<a name="l00124"></a><a class="code" href="structapr__proc__t.html#o0">00124</a>     pid_t <a class="code" href="structapr__proc__t.html#o0">pid</a>;<span class="comment"></span>
+00125 <span class="comment">    /** Parent's side of pipe to child's stdin */</span>
+<a name="l00126"></a><a class="code" href="structapr__proc__t.html#o1">00126</a>     <a class="code" href="group__apr__file__io.html#ga2">apr_file_t</a> *<a class="code" href="structapr__proc__t.html#o1">in</a>;<span class="comment"></span>
+00127 <span class="comment">    /** Parent's side of pipe to child's stdout */</span>
+<a name="l00128"></a><a class="code" href="structapr__proc__t.html#o2">00128</a>     <a class="code" href="group__apr__file__io.html#ga2">apr_file_t</a> *<a class="code" href="structapr__proc__t.html#o2">out</a>;<span class="comment"></span>
+00129 <span class="comment">    /** Parent's side of pipe to child's stdouterr */</span>
+<a name="l00130"></a><a class="code" href="structapr__proc__t.html#o3">00130</a>     <a class="code" href="group__apr__file__io.html#ga2">apr_file_t</a> *<a class="code" href="structapr__proc__t.html#o3">err</a>;
+00131 <span class="preprocessor">#if APR_HAS_PROC_INVOKED || defined(DOXYGEN)</span>
+00132 <span class="preprocessor"></span><span class="comment">    /** Diagnositics/debugging string of the command invoked for </span>
+00133 <span class="comment">     *  this process [only present if APR_HAS_PROC_INVOKED is true]</span>
+00134 <span class="comment">     * @remark Only enabled on Win32 by default.</span>
+00135 <span class="comment">     * @bug This should either always or never be present in release</span>
+00136 <span class="comment">     * builds - since it breaks binary compatibility.  We may enable</span>
+00137 <span class="comment">     * it always in APR 1.0 yet leave it undefined in most cases.</span>
+00138 <span class="comment">     */</span>
+<a name="l00139"></a><a class="code" href="structapr__proc__t.html#o4">00139</a>     <span class="keywordtype">char</span> *<a class="code" href="structapr__proc__t.html#o4">invoked</a>;
+00140 <span class="preprocessor">#endif</span>
+00141 <span class="preprocessor"></span><span class="preprocessor">#if defined(WIN32) || defined(DOXYGEN)</span>
+00142 <span class="preprocessor"></span><span class="comment">    /** (Win32 only) Creator's handle granting access to the process</span>
+00143 <span class="comment">     * @remark This handle is closed and reset to NULL in every case</span>
+00144 <span class="comment">     * corresponding to a waitpid() on Unix which returns the exit status.</span>
+00145 <span class="comment">     * Therefore Win32 correspond's to Unix's zombie reaping characteristics</span>
+00146 <span class="comment">     * and avoids potential handle leaks.</span>
+00147 <span class="comment">     */</span>
+<a name="l00148"></a><a class="code" href="structapr__proc__t.html#o5">00148</a>     HANDLE <a class="code" href="structapr__proc__t.html#o5">hproc</a>;
+00149 <span class="preprocessor">#endif</span>
+00150 <span class="preprocessor"></span>} <a class="code" href="structapr__proc__t.html">apr_proc_t</a>;
+00151 <span class="comment"></span>
+00152 <span class="comment">/**</span>
+00153 <span class="comment"> * The prototype for APR child errfn functions.  (See the description</span>
+00154 <span class="comment"> * of apr_procattr_child_errfn_set() for more information.)</span>
+00155 <span class="comment"> * It is passed the following parameters:</span>
+00156 <span class="comment"> * @param pool Pool associated with the apr_proc_t.  If your child</span>
+00157 <span class="comment"> *             error function needs user data, associate it with this</span>
+00158 <span class="comment"> *             pool.</span>
+00159 <span class="comment"> * @param err APR error code describing the error</span>
+00160 <span class="comment"> * @param description Text description of type of processing which failed</span>
+00161 <span class="comment"> */</span>
+<a name="l00162"></a><a class="code" href="group__apr__thread__proc.html#ga1">00162</a> <span class="keyword">typedef</span> void (<a class="code" href="group__apr__thread__proc.html#ga1">apr_child_errfn_t</a>)(<a class="code" href="group__apr__pools.html#ga0">apr_pool_t</a> *proc, <a class="code" href="group__apr__errno.html#ga0">apr_status_t</a> err,
+00163                                  <span class="keyword">const</span> <span class="keywordtype">char</span> *description);
+00164 <span class="comment"></span>
+00165 <span class="comment">/** Opaque Thread structure. */</span>
+<a name="l00166"></a><a class="code" href="group__apr__thread__proc.html#ga2">00166</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__thread__proc.html#ga2">apr_thread_t</a>           <a class="code" href="group__apr__thread__proc.html#ga2">apr_thread_t</a>;
+00167 <span class="comment"></span>
+00168 <span class="comment">/** Opaque Thread attributes structure. */</span>
+<a name="l00169"></a><a class="code" href="group__apr__thread__proc.html#ga3">00169</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__thread__proc.html#ga3">apr_threadattr_t</a>       <a class="code" href="group__apr__thread__proc.html#ga3">apr_threadattr_t</a>;
+00170 <span class="comment"></span>
+00171 <span class="comment">/** Opaque Process attributes structure. */</span>
+<a name="l00172"></a><a class="code" href="group__apr__thread__proc.html#ga4">00172</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__thread__proc.html#ga4">apr_procattr_t</a>         <a class="code" href="group__apr__thread__proc.html#ga4">apr_procattr_t</a>;
+00173 <span class="comment"></span>
+00174 <span class="comment">/** Opaque control variable for one-time atomic variables.  */</span>
+<a name="l00175"></a><a class="code" href="group__apr__thread__proc.html#ga5">00175</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__thread__proc.html#ga5">apr_thread_once_t</a>      <a class="code" href="group__apr__thread__proc.html#ga5">apr_thread_once_t</a>;
+00176 <span class="comment"></span>
+00177 <span class="comment">/** Opaque thread private address space. */</span>
+<a name="l00178"></a><a class="code" href="group__apr__thread__proc.html#ga6">00178</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__thread__proc.html#ga6">apr_threadkey_t</a>        <a class="code" href="group__apr__thread__proc.html#ga6">apr_threadkey_t</a>;
+00179 <span class="comment"></span>
+00180 <span class="comment">/** Opaque record of child process. */</span>
+<a name="l00181"></a><a class="code" href="group__apr__thread__proc.html#ga7">00181</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__thread__proc.html#ga7">apr_other_child_rec_t</a>  <a class="code" href="group__apr__thread__proc.html#ga7">apr_other_child_rec_t</a>;
+00182 <span class="comment"></span>
+00183 <span class="comment">/**</span>
+00184 <span class="comment"> * The prototype for any APR thread worker functions.</span>
+00185 <span class="comment"> */</span>
+<a name="l00186"></a><a class="code" href="group__apr__thread__proc.html#ga8">00186</a> <span class="keyword">typedef</span> <span class="keywordtype">void</span> *(APR_THREAD_FUNC *<a class="code" href="group__apr__thread__proc.html#ga8">apr_thread_start_t</a>)(<a class="code" href="group__apr__thread__proc.html#ga2">apr_thread_t</a>*, <span class="keywordtype">void</span>*);
+00187 
+<a name="l00188"></a><a class="code" href="group__apr__thread__proc.html#ga71">00188</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00189     <a class="code" href="group__apr__thread__proc.html#gga71a39">APR_KILL_NEVER</a>,             <span class="comment">/**&lt; process is never sent any signals */</span>
+00190     <a class="code" href="group__apr__thread__proc.html#gga71a40">APR_KILL_ALWAYS</a>,            <span class="comment">/**&lt; process is sent SIGKILL on apr_pool_t cleanup */</span>
+00191     <a class="code" href="group__apr__thread__proc.html#gga71a41">APR_KILL_AFTER_TIMEOUT</a>,     <span class="comment">/**&lt; SIGTERM, wait 3 seconds, SIGKILL */</span>
+00192     <a class="code" href="group__apr__thread__proc.html#gga71a42">APR_JUST_WAIT</a>,              <span class="comment">/**&lt; wait forever for the process to complete */</span>
+00193     <a class="code" href="group__apr__thread__proc.html#gga71a43">APR_KILL_ONLY_ONCE</a>          <span class="comment">/**&lt; send SIGTERM and then wait */</span>
+00194 } <a class="code" href="group__apr__thread__proc.html#ga71">apr_kill_conditions_e</a>;
+00195 
+00196 <span class="comment">/* Thread Function definitions */</span>
+00197 
+00198 <span class="preprocessor">#if APR_HAS_THREADS</span>
+00199 <span class="preprocessor"></span><span class="comment"></span>
+00200 <span class="comment">/**</span>
+00201 <span class="comment"> * Create and initialize a new threadattr variable</span>
+00202 <span class="comment"> * @param new_attr The newly created threadattr.</span>
+00203 <span class="comment"> * @param cont The pool to use</span>
+00204 <span class="comment"> */</span>
+00205 APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new_attr, 
+00206                                                 apr_pool_t *cont);
+00207 <span class="comment"></span>
+00208 <span class="comment">/**</span>
+00209 <span class="comment"> * Set if newly created threads should be created in detached state.</span>
+00210 <span class="comment"> * @param attr The threadattr to affect </span>
+00211 <span class="comment"> * @param on Non-zero if detached threads should be created.</span>
+00212 <span class="comment"> */</span>
+00213 APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, 
+00214                                                     apr_int32_t on);
+00215 <span class="comment"></span>
+00216 <span class="comment">/**</span>
+00217 <span class="comment"> * Get the detach state for this threadattr.</span>
+00218 <span class="comment"> * @param attr The threadattr to reference</span>
+00219 <span class="comment"> * @return APR_DETACH if threads are to be detached, or APR_NOTDETACH</span>
+00220 <span class="comment"> * if threads are to be joinable. </span>
+00221 <span class="comment"> */</span>
+00222 APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr);
+00223 <span class="comment"></span>
+00224 <span class="comment">/**</span>
+00225 <span class="comment"> * Set the stack size of newly created threads.</span>
+00226 <span class="comment"> * @param attr The threadattr to affect </span>
+00227 <span class="comment"> * @param stacksize The stack size in bytes</span>
+00228 <span class="comment"> */</span>
+00229 APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr,
+00230                                                        apr_size_t stacksize);
+00231 <span class="comment"></span>
+00232 <span class="comment">/**</span>
+00233 <span class="comment"> * Set the stack guard area size of newly created threads.</span>
+00234 <span class="comment"> * @param attr The threadattr to affect </span>
+00235 <span class="comment"> * @param guardsize The stack guard area size in bytes</span>
+00236 <span class="comment"> * @note Thread library implementations commonly use a "guard area"</span>
+00237 <span class="comment"> * after each thread's stack which is not readable or writable such that</span>
+00238 <span class="comment"> * stack overflows cause a segfault; this consumes e.g. 4K of memory</span>
+00239 <span class="comment"> * and increases memory management overhead.  Setting the guard area</span>
+00240 <span class="comment"> * size to zero hence trades off reliable behaviour on stack overflow</span>
+00241 <span class="comment"> * for performance. */</span>
+00242 APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
+00243                                                        apr_size_t guardsize);
+00244 <span class="comment"></span>
+00245 <span class="comment">/**</span>
+00246 <span class="comment"> * Create a new thread of execution</span>
+00247 <span class="comment"> * @param new_thread The newly created thread handle.</span>
+00248 <span class="comment"> * @param attr The threadattr to use to determine how to create the thread</span>
+00249 <span class="comment"> * @param func The function to start the new thread in</span>
+00250 <span class="comment"> * @param data Any data to be passed to the starting function</span>
+00251 <span class="comment"> * @param cont The pool to use</span>
+00252 <span class="comment"> */</span>
+00253 APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new_thread, 
+00254                                             apr_threadattr_t *attr, 
+00255                                             apr_thread_start_t func, 
+00256                                             <span class="keywordtype">void</span> *data, apr_pool_t *cont);
+00257 <span class="comment"></span>
+00258 <span class="comment">/**</span>
+00259 <span class="comment"> * stop the current thread</span>
+00260 <span class="comment"> * @param thd The thread to stop</span>
+00261 <span class="comment"> * @param retval The return value to pass back to any thread that cares</span>
+00262 <span class="comment"> */</span>
+00263 APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, 
+00264                                           apr_status_t retval);
+00265 <span class="comment"></span>
+00266 <span class="comment">/**</span>
+00267 <span class="comment"> * block until the desired thread stops executing.</span>
+00268 <span class="comment"> * @param retval The return value from the dead thread.</span>
+00269 <span class="comment"> * @param thd The thread to join</span>
+00270 <span class="comment"> */</span>
+00271 APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, 
+00272                                           apr_thread_t *thd); 
+00273 <span class="comment"></span>
+00274 <span class="comment">/**</span>
+00275 <span class="comment"> * force the current thread to yield the processor</span>
+00276 <span class="comment"> */</span>
+00277 APR_DECLARE(<span class="keywordtype">void</span>) apr_thread_yield(<span class="keywordtype">void</span>);
+00278 <span class="comment"></span>
+00279 <span class="comment">/**</span>
+00280 <span class="comment"> * Initialize the control variable for apr_thread_once.  If this isn't</span>
+00281 <span class="comment"> * called, apr_initialize won't work.</span>
+00282 <span class="comment"> * @param control The control variable to initialize</span>
+00283 <span class="comment"> * @param p The pool to allocate data from.</span>
+00284 <span class="comment"> */</span>
+00285 APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control,
+00286                                                apr_pool_t *p);
+00287 <span class="comment"></span>
+00288 <span class="comment">/**</span>
+00289 <span class="comment"> * Run the specified function one time, regardless of how many threads</span>
+00290 <span class="comment"> * call it.</span>
+00291 <span class="comment"> * @param control The control variable.  The same variable should</span>
+00292 <span class="comment"> *                be passed in each time the function is tried to be</span>
+00293 <span class="comment"> *                called.  This is how the underlying functions determine</span>
+00294 <span class="comment"> *                if the function has ever been called before.</span>
+00295 <span class="comment"> * @param func The function to call.</span>
+00296 <span class="comment"> */</span>
+00297 APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control,
+00298                                           <span class="keywordtype">void</span> (*func)(<span class="keywordtype">void</span>));
+00299 <span class="comment"></span>
+00300 <span class="comment">/**</span>
+00301 <span class="comment"> * detach a thread</span>
+00302 <span class="comment"> * @param thd The thread to detach </span>
+00303 <span class="comment"> */</span>
+00304 APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd);
+00305 <span class="comment"></span>
+00306 <span class="comment">/**</span>
+00307 <span class="comment"> * Return the pool associated with the current thread.</span>
+00308 <span class="comment"> * @param data The user data associated with the thread.</span>
+00309 <span class="comment"> * @param key The key to associate with the data</span>
+00310 <span class="comment"> * @param thread The currently open thread.</span>
+00311 <span class="comment"> */</span>
+00312 APR_DECLARE(apr_status_t) apr_thread_data_get(<span class="keywordtype">void</span> **data, const <span class="keywordtype">char</span> *key,
+00313                                              apr_thread_t *thread);
+00314 <span class="comment"></span>
+00315 <span class="comment">/**</span>
+00316 <span class="comment"> * Return the pool associated with the current thread.</span>
+00317 <span class="comment"> * @param data The user data to associate with the thread.</span>
+00318 <span class="comment"> * @param key The key to use for associating the data with the tread</span>
+00319 <span class="comment"> * @param cleanup The cleanup routine to use when the thread is destroyed.</span>
+00320 <span class="comment"> * @param thread The currently open thread.</span>
+00321 <span class="comment"> */</span>
+00322 APR_DECLARE(apr_status_t) apr_thread_data_set(<span class="keywordtype">void</span> *data, const <span class="keywordtype">char</span> *key,
+00323                                              apr_status_t (*cleanup) (<span class="keywordtype">void</span> *),
+00324                                              apr_thread_t *thread);
+00325 <span class="comment"></span>
+00326 <span class="comment">/**</span>
+00327 <span class="comment"> * Create and initialize a new thread private address space</span>
+00328 <span class="comment"> * @param key The thread private handle.</span>
+00329 <span class="comment"> * @param dest The destructor to use when freeing the private memory.</span>
+00330 <span class="comment"> * @param cont The pool to use</span>
+00331 <span class="comment"> */</span>
+00332 APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key, 
+00333                                                     <span class="keywordtype">void</span> (*dest)(<span class="keywordtype">void</span> *),
+00334                                                     apr_pool_t *cont);
+00335 <span class="comment"></span>
+00336 <span class="comment">/**</span>
+00337 <span class="comment"> * Get a pointer to the thread private memory</span>
+00338 <span class="comment"> * @param new_mem The data stored in private memory </span>
+00339 <span class="comment"> * @param key The handle for the desired thread private memory </span>
+00340 <span class="comment"> */</span>
+00341 APR_DECLARE(apr_status_t) apr_threadkey_private_get(<span class="keywordtype">void</span> **new_mem, 
+00342                                                  apr_threadkey_t *key);
+00343 <span class="comment"></span>
+00344 <span class="comment">/**</span>
+00345 <span class="comment"> * Set the data to be stored in thread private memory</span>
+00346 <span class="comment"> * @param priv The data to be stored in private memory </span>
+00347 <span class="comment"> * @param key The handle for the desired thread private memory </span>
+00348 <span class="comment"> */</span>
+00349 APR_DECLARE(apr_status_t) apr_threadkey_private_set(<span class="keywordtype">void</span> *priv, 
+00350                                                  apr_threadkey_t *key);
+00351 <span class="comment"></span>
+00352 <span class="comment">/**</span>
+00353 <span class="comment"> * Free the thread private memory</span>
+00354 <span class="comment"> * @param key The handle for the desired thread private memory </span>
+00355 <span class="comment"> */</span>
+00356 APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key);
+00357 <span class="comment"></span>
+00358 <span class="comment">/**</span>
+00359 <span class="comment"> * Return the pool associated with the current threadkey.</span>
+00360 <span class="comment"> * @param data The user data associated with the threadkey.</span>
+00361 <span class="comment"> * @param key The key associated with the data</span>
+00362 <span class="comment"> * @param threadkey The currently open threadkey.</span>
+00363 <span class="comment"> */</span>
+00364 APR_DECLARE(apr_status_t) apr_threadkey_data_get(<span class="keywordtype">void</span> **data, const <span class="keywordtype">char</span> *key,
+00365                                                 apr_threadkey_t *threadkey);
+00366 <span class="comment"></span>
+00367 <span class="comment">/**</span>
+00368 <span class="comment"> * Return the pool associated with the current threadkey.</span>
+00369 <span class="comment"> * @param data The data to set.</span>
+00370 <span class="comment"> * @param key The key to associate with the data.</span>
+00371 <span class="comment"> * @param cleanup The cleanup routine to use when the file is destroyed.</span>
+00372 <span class="comment"> * @param threadkey The currently open threadkey.</span>
+00373 <span class="comment"> */</span>
+00374 APR_DECLARE(apr_status_t) apr_threadkey_data_set(<span class="keywordtype">void</span> *data, const <span class="keywordtype">char</span> *key,
+00375                                                 apr_status_t (*cleanup) (<span class="keywordtype">void</span> *),
+00376                                                 apr_threadkey_t *threadkey);
+00377 
+00378 #endif
+00379 <span class="comment"></span>
+00380 <span class="comment">/**</span>
+00381 <span class="comment"> * Create and initialize a new procattr variable</span>
+00382 <span class="comment"> * @param new_attr The newly created procattr. </span>
+00383 <span class="comment"> * @param cont The pool to use</span>
+00384 <span class="comment"> */</span>
+00385 APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new_attr,
+00386                                                   apr_pool_t *cont);
+00387 <span class="comment"></span>
+00388 <span class="comment">/**</span>
+00389 <span class="comment"> * Determine if any of stdin, stdout, or stderr should be linked to pipes </span>
+00390 <span class="comment"> * when starting a child process.</span>
+00391 <span class="comment"> * @param attr The procattr we care about. </span>
+00392 <span class="comment"> * @param in Should stdin be a pipe back to the parent?</span>
+00393 <span class="comment"> * @param out Should stdout be a pipe back to the parent?</span>
+00394 <span class="comment"> * @param err Should stderr be a pipe back to the parent?</span>
+00395 <span class="comment"> */</span>
+00396 APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, 
+00397                                              apr_int32_t in, apr_int32_t out,
+00398                                              apr_int32_t err);
+00399 <span class="comment"></span>
+00400 <span class="comment">/**</span>
+00401 <span class="comment"> * Set the child_in and/or parent_in values to existing apr_file_t values.</span>
+00402 <span class="comment"> * @param attr The procattr we care about. </span>
+00403 <span class="comment"> * @param child_in apr_file_t value to use as child_in. Must be a valid file.</span>
+00404 <span class="comment"> * @param parent_in apr_file_t value to use as parent_in. Must be a valid file.</span>
+00405 <span class="comment"> * @remark  This is NOT a required initializer function. This is</span>
+00406 <span class="comment"> *          useful if you have already opened a pipe (or multiple files)</span>
+00407 <span class="comment"> *          that you wish to use, perhaps persistently across multiple</span>
+00408 <span class="comment"> *          process invocations - such as a log file. You can save some </span>
+00409 <span class="comment"> *          extra function calls by not creating your own pipe since this</span>
+00410 <span class="comment"> *          creates one in the process space for you.</span>
+00411 <span class="comment"> */</span>
+00412 APR_DECLARE(apr_status_t) apr_procattr_child_in_set(struct apr_procattr_t *attr,
+00413                                                   apr_file_t *child_in,
+00414                                                   apr_file_t *parent_in);
+00415 <span class="comment"></span>
+00416 <span class="comment">/**</span>
+00417 <span class="comment"> * Set the child_out and parent_out values to existing apr_file_t values.</span>
+00418 <span class="comment"> * @param attr The procattr we care about. </span>
+00419 <span class="comment"> * @param child_out apr_file_t value to use as child_out. Must be a valid file.</span>
+00420 <span class="comment"> * @param parent_out apr_file_t value to use as parent_out. Must be a valid file.</span>
+00421 <span class="comment"> * @remark This is NOT a required initializer function. This is</span>
+00422 <span class="comment"> *         useful if you have already opened a pipe (or multiple files)</span>
+00423 <span class="comment"> *         that you wish to use, perhaps persistently across multiple</span>
+00424 <span class="comment"> *         process invocations - such as a log file. </span>
+00425 <span class="comment"> */</span>
+00426 APR_DECLARE(apr_status_t) apr_procattr_child_out_set(struct apr_procattr_t *attr,
+00427                                                    apr_file_t *child_out,
+00428                                                    apr_file_t *parent_out);
+00429 <span class="comment"></span>
+00430 <span class="comment">/**</span>
+00431 <span class="comment"> * Set the child_err and parent_err values to existing apr_file_t values.</span>
+00432 <span class="comment"> * @param attr The procattr we care about. </span>
+00433 <span class="comment"> * @param child_err apr_file_t value to use as child_err. Must be a valid file.</span>
+00434 <span class="comment"> * @param parent_err apr_file_t value to use as parent_err. Must be a valid file.</span>
+00435 <span class="comment"> * @remark This is NOT a required initializer function. This is</span>

[... 611 lines stripped ...]


Mime
View raw message