Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 243222a43997d44a8ac787d018c9535c > files > 63

apr-docs-1.2.7-11.el5_6.5.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Apache Portable Runtime: apr_thread_cond.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
    <li id="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
    <li><a href="examples.html"><span>Examples</span></a></li>
  </ul></div>
<div class="tabs">
  <ul>
    <li><a href="files.html"><span>File&nbsp;List</span></a></li>
    <li><a href="globals.html"><span>Globals</span></a></li>
  </ul></div>
<h1>apr_thread_cond.h</h1><a href="apr__thread__cond_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as</span>
<a name="l00002"></a>00002 <span class="comment"> * applicable.</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="l00005"></a>00005 <span class="comment"> * you may not use this file except in compliance with the License.</span>
<a name="l00006"></a>00006 <span class="comment"> * You may obtain a copy of the License at</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> *     http://www.apache.org/licenses/LICENSE-2.0</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
<a name="l00011"></a>00011 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="l00012"></a>00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="l00013"></a>00013 <span class="comment"> * See the License for the specific language governing permissions and</span>
<a name="l00014"></a>00014 <span class="comment"> * limitations under the License.</span>
<a name="l00015"></a>00015 <span class="comment"> */</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#ifndef APR_THREAD_COND_H</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define APR_THREAD_COND_H</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00020"></a>00020 <span class="comment">/**</span>
<a name="l00021"></a>00021 <span class="comment"> * @file apr_thread_cond.h</span>
<a name="l00022"></a>00022 <span class="comment"> * @brief APR Condition Variable Routines</span>
<a name="l00023"></a>00023 <span class="comment"> */</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="apr_8h.html">apr.h</a>"</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="apr__pools_8h.html">apr_pools.h</a>"</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="apr__errno_8h.html">apr_errno.h</a>"</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include "<a class="code" href="apr__time_8h.html">apr_time.h</a>"</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="apr__thread__mutex_8h.html">apr_thread_mutex.h</a>"</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
<a name="l00033"></a>00033 <span class="preprocessor">#endif </span><span class="comment">/* __cplusplus */</span>
<a name="l00034"></a>00034 
<a name="l00035"></a>00035 <span class="preprocessor">#if APR_HAS_THREADS || defined(DOXYGEN)</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00037"></a>00037 <span class="comment">/**</span>
<a name="l00038"></a>00038 <span class="comment"> * @defgroup apr_thread_cond Condition Variable Routines</span>
<a name="l00039"></a>00039 <span class="comment"> * @ingroup APR </span>
<a name="l00040"></a>00040 <span class="comment"> * @{</span>
<a name="l00041"></a>00041 <span class="comment"> */</span>
<a name="l00042"></a>00042 <span class="comment"></span>
<a name="l00043"></a>00043 <span class="comment">/** Opaque structure for thread condition variables */</span>
<a name="l00044"></a><a class="code" href="group__apr__thread__cond.html#g0495d4d1b17c60983fce51cb09b15b86">00044</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="group__apr__thread__cond.html#g0495d4d1b17c60983fce51cb09b15b86">apr_thread_cond_t</a> apr_thread_cond_t;
<a name="l00045"></a>00045 <span class="comment"></span>
<a name="l00046"></a>00046 <span class="comment">/**</span>
<a name="l00047"></a>00047 <span class="comment"> * Note: destroying a condition variable (or likewise, destroying or</span>
<a name="l00048"></a>00048 <span class="comment"> * clearing the pool from which a condition variable was allocated) if</span>
<a name="l00049"></a>00049 <span class="comment"> * any threads are blocked waiting on it gives undefined results.</span>
<a name="l00050"></a>00050 <span class="comment"> */</span>
<a name="l00051"></a>00051 <span class="comment"></span>
<a name="l00052"></a>00052 <span class="comment">/**</span>
<a name="l00053"></a>00053 <span class="comment"> * Create and initialize a condition variable that can be used to signal</span>
<a name="l00054"></a>00054 <span class="comment"> * and schedule threads in a single process.</span>
<a name="l00055"></a>00055 <span class="comment"> * @param cond the memory address where the newly created condition variable</span>
<a name="l00056"></a>00056 <span class="comment"> *        will be stored.</span>
<a name="l00057"></a>00057 <span class="comment"> * @param pool the pool from which to allocate the mutex.</span>
<a name="l00058"></a>00058 <span class="comment"> */</span>
<a name="l00059"></a>00059 <a class="code" href="group__apr__platform.html#g4a5cbc739c4e19ab450020163d0899d4">APR_DECLARE</a>(<a class="code" href="group__apr__errno.html#g4cf2ddae3efce70c508ac7fefc1c47f7">apr_status_t</a>) <a class="code" href="group__apr__thread__cond.html#g9176e4f1e512f4ed9511fbb4fc6a45fa">apr_thread_cond_create</a>(apr_thread_cond_t **cond,
<a name="l00060"></a>00060                                                  <a class="code" href="group__apr__pools.html#g06f17a7732f2d04d8ce7010fbb057a8b">apr_pool_t</a> *pool);
<a name="l00061"></a>00061 <span class="comment"></span>
<a name="l00062"></a>00062 <span class="comment">/**</span>
<a name="l00063"></a>00063 <span class="comment"> * Put the active calling thread to sleep until signaled to wake up. Each</span>
<a name="l00064"></a>00064 <span class="comment"> * condition variable must be associated with a mutex, and that mutex must</span>
<a name="l00065"></a>00065 <span class="comment"> * be locked before  calling this function, or the behavior will be</span>
<a name="l00066"></a>00066 <span class="comment"> * undefined. As the calling thread is put to sleep, the given mutex</span>
<a name="l00067"></a>00067 <span class="comment"> * will be simultaneously released; and as this thread wakes up the lock</span>
<a name="l00068"></a>00068 <span class="comment"> * is again simultaneously acquired.</span>
<a name="l00069"></a>00069 <span class="comment"> * @param cond the condition variable on which to block.</span>
<a name="l00070"></a>00070 <span class="comment"> * @param mutex the mutex that must be locked upon entering this function,</span>
<a name="l00071"></a>00071 <span class="comment"> *        is released while the thread is asleep, and is again acquired before</span>
<a name="l00072"></a>00072 <span class="comment"> *        returning from this function.</span>
<a name="l00073"></a>00073 <span class="comment"> */</span>
<a name="l00074"></a>00074 <a class="code" href="group__apr__platform.html#g4a5cbc739c4e19ab450020163d0899d4">APR_DECLARE</a>(<a class="code" href="group__apr__errno.html#g4cf2ddae3efce70c508ac7fefc1c47f7">apr_status_t</a>) <a class="code" href="group__apr__thread__cond.html#g605aa511bb15e8aa7b8e95c3c7577090">apr_thread_cond_wait</a>(apr_thread_cond_t *cond,
<a name="l00075"></a>00075                                                <a class="code" href="group__apr__thread__mutex.html#g403b0b4658868d93e2b773e671ef06a7">apr_thread_mutex_t</a> *mutex);
<a name="l00076"></a>00076 <span class="comment"></span>
<a name="l00077"></a>00077 <span class="comment">/**</span>
<a name="l00078"></a>00078 <span class="comment"> * Put the active calling thread to sleep until signaled to wake up or</span>
<a name="l00079"></a>00079 <span class="comment"> * the timeout is reached. Each condition variable must be associated</span>
<a name="l00080"></a>00080 <span class="comment"> * with a mutex, and that mutex must be locked before calling this</span>
<a name="l00081"></a>00081 <span class="comment"> * function, or the behavior will be undefined. As the calling thread</span>
<a name="l00082"></a>00082 <span class="comment"> * is put to sleep, the given mutex will be simultaneously released;</span>
<a name="l00083"></a>00083 <span class="comment"> * and as this thread wakes up the lock is again simultaneously acquired.</span>
<a name="l00084"></a>00084 <span class="comment"> * @param cond the condition variable on which to block.</span>
<a name="l00085"></a>00085 <span class="comment"> * @param mutex the mutex that must be locked upon entering this function,</span>
<a name="l00086"></a>00086 <span class="comment"> *        is released while the thread is asleep, and is again acquired before</span>
<a name="l00087"></a>00087 <span class="comment"> *        returning from this function.</span>
<a name="l00088"></a>00088 <span class="comment"> * @param timeout The amount of time in microseconds to wait. This is </span>
<a name="l00089"></a>00089 <span class="comment"> *        a maximum, not a minimum. If the condition is signaled, we </span>
<a name="l00090"></a>00090 <span class="comment"> *        will wake up before this time, otherwise the error APR_TIMEUP</span>
<a name="l00091"></a>00091 <span class="comment"> *        is returned.</span>
<a name="l00092"></a>00092 <span class="comment"> */</span>
<a name="l00093"></a>00093 <a class="code" href="group__apr__platform.html#g4a5cbc739c4e19ab450020163d0899d4">APR_DECLARE</a>(<a class="code" href="group__apr__errno.html#g4cf2ddae3efce70c508ac7fefc1c47f7">apr_status_t</a>) <a class="code" href="group__apr__thread__cond.html#gaaa80fef1504e39d15a9c1da620cb4ad">apr_thread_cond_timedwait</a>(apr_thread_cond_t *cond,
<a name="l00094"></a>00094                                                     <a class="code" href="group__apr__thread__mutex.html#g403b0b4658868d93e2b773e671ef06a7">apr_thread_mutex_t</a> *mutex,
<a name="l00095"></a>00095                                                     <a class="code" href="group__apr__time.html#g4867ccc083452a265915ac7dfafde457">apr_interval_time_t</a> timeout);
<a name="l00096"></a>00096 <span class="comment"></span>
<a name="l00097"></a>00097 <span class="comment">/**</span>
<a name="l00098"></a>00098 <span class="comment"> * Signals a single thread, if one exists, that is blocking on the given</span>
<a name="l00099"></a>00099 <span class="comment"> * condition variable. That thread is then scheduled to wake up and acquire</span>
<a name="l00100"></a>00100 <span class="comment"> * the associated mutex. Although it is not required, if predictable scheduling</span>
<a name="l00101"></a>00101 <span class="comment"> * is desired, that mutex must be locked while calling this function.</span>
<a name="l00102"></a>00102 <span class="comment"> * @param cond the condition variable on which to produce the signal.</span>
<a name="l00103"></a>00103 <span class="comment"> */</span>
<a name="l00104"></a>00104 <a class="code" href="group__apr__platform.html#g4a5cbc739c4e19ab450020163d0899d4">APR_DECLARE</a>(<a class="code" href="group__apr__errno.html#g4cf2ddae3efce70c508ac7fefc1c47f7">apr_status_t</a>) <a class="code" href="group__apr__thread__cond.html#g75f045a984feba79b1fddca65c9876f1">apr_thread_cond_signal</a>(apr_thread_cond_t *cond);
<a name="l00105"></a>00105 <span class="comment"></span>
<a name="l00106"></a>00106 <span class="comment">/**</span>
<a name="l00107"></a>00107 <span class="comment"> * Signals all threads blocking on the given condition variable.</span>
<a name="l00108"></a>00108 <span class="comment"> * Each thread that was signaled is then scheduled to wake up and acquire</span>
<a name="l00109"></a>00109 <span class="comment"> * the associated mutex. This will happen in a serialized manner.</span>
<a name="l00110"></a>00110 <span class="comment"> * @param cond the condition variable on which to produce the broadcast.</span>
<a name="l00111"></a>00111 <span class="comment"> */</span>
<a name="l00112"></a>00112 <a class="code" href="group__apr__platform.html#g4a5cbc739c4e19ab450020163d0899d4">APR_DECLARE</a>(<a class="code" href="group__apr__errno.html#g4cf2ddae3efce70c508ac7fefc1c47f7">apr_status_t</a>) <a class="code" href="group__apr__thread__cond.html#g795ee44bf548e6217cc6920742892f9f">apr_thread_cond_broadcast</a>(apr_thread_cond_t *cond);
<a name="l00113"></a>00113 <span class="comment"></span>
<a name="l00114"></a>00114 <span class="comment">/**</span>
<a name="l00115"></a>00115 <span class="comment"> * Destroy the condition variable and free the associated memory.</span>
<a name="l00116"></a>00116 <span class="comment"> * @param cond the condition variable to destroy.</span>
<a name="l00117"></a>00117 <span class="comment"> */</span>
<a name="l00118"></a>00118 <a class="code" href="group__apr__platform.html#g4a5cbc739c4e19ab450020163d0899d4">APR_DECLARE</a>(<a class="code" href="group__apr__errno.html#g4cf2ddae3efce70c508ac7fefc1c47f7">apr_status_t</a>) <a class="code" href="group__apr__thread__cond.html#g4ff7582659b0cd2a6463603de865bd36">apr_thread_cond_destroy</a>(apr_thread_cond_t *cond);
<a name="l00119"></a>00119 <span class="comment"></span>
<a name="l00120"></a>00120 <span class="comment">/**</span>
<a name="l00121"></a>00121 <span class="comment"> * Get the pool used by this thread_cond.</span>
<a name="l00122"></a>00122 <span class="comment"> * @return apr_pool_t the pool</span>
<a name="l00123"></a>00123 <span class="comment"> */</span>
<a name="l00124"></a>00124 <a class="code" href="group__apr__pools.html#g6dda96940d296b27a1bc98d9f49735e4">APR_POOL_DECLARE_ACCESSOR</a>(thread_cond);
<a name="l00125"></a>00125 
<a name="l00126"></a>00126 <span class="preprocessor">#endif </span><span class="comment">/* APR_HAS_THREADS */</span>
<a name="l00127"></a>00127 <span class="comment"></span>
<a name="l00128"></a>00128 <span class="comment">/** @} */</span>
<a name="l00129"></a>00129 
<a name="l00130"></a>00130 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00131"></a>00131 <span class="preprocessor"></span>}
<a name="l00132"></a>00132 <span class="preprocessor">#endif</span>
<a name="l00133"></a>00133 <span class="preprocessor"></span>
<a name="l00134"></a>00134 <span class="preprocessor">#endif  </span><span class="comment">/* ! APR_THREAD_COND_H */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue May 31 12:43:38 2011 for Apache Portable Runtime by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>