⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apr__thread__proc_8h-source.html

📁 apr函数库使用手册
💻 HTML
📖 第 1 页 / 共 5 页
字号:
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,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -