Sophie

Sophie

distrib > Mandriva > 10.2 > i586 > by-pkgid > 4f37b923758ceff94a2c0ccca62b4b43 > files > 59

libapr1-devel-1.1.1-1mdk.i586.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_atomic.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.9.1 -->
<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>
<div class="nav">
<a class="el" href="dir_000000.html">home</a>&nbsp;/&nbsp;<a class="el" href="dir_000001.html">oden</a>&nbsp;/&nbsp;<a class="el" href="dir_000002.html">RPM</a>&nbsp;/&nbsp;<a class="el" href="dir_000003.html">BUILD</a>&nbsp;/&nbsp;<a class="el" href="dir_000004.html">apr-1.1.1</a>&nbsp;/&nbsp;<a class="el" href="dir_000005.html">include</a></div>
<h1>apr_atomic.h</h1><a href="apr__atomic_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">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_ATOMIC_H</span>
00017 <span class="preprocessor"></span><span class="preprocessor">#define APR_ATOMIC_H</span>
00018 <span class="preprocessor"></span><span class="comment"></span>
00019 <span class="comment">/**</span>
00020 <span class="comment"> * @file apr_atomic.h</span>
00021 <span class="comment"> * @brief APR Atomic Operations</span>
00022 <span class="comment"> */</span>
00023 
00024 <span class="preprocessor">#include "<a class="code" href="apr_8h.html">apr.h</a>"</span>
00025 <span class="preprocessor">#include "<a class="code" href="apr__pools_8h.html">apr_pools.h</a>"</span>
00026 
00027 <span class="preprocessor">#ifdef __cplusplus</span>
00028 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
00029 <span class="preprocessor">#endif</span>
00030 <span class="preprocessor"></span><span class="comment"></span>
00031 <span class="comment">/**</span>
00032 <span class="comment"> * @defgroup apr_atomic Atomic Operations</span>
00033 <span class="comment"> * @ingroup APR </span>
00034 <span class="comment"> * @{</span>
00035 <span class="comment"> */</span>
00036 <span class="comment"></span>
00037 <span class="comment">/**</span>
00038 <span class="comment"> * this function is required on some platforms to initialize the</span>
00039 <span class="comment"> * atomic operation's internal structures</span>
00040 <span class="comment"> * @param p pool</span>
00041 <span class="comment"> * @return APR_SUCCESS on successful completion</span>
00042 <span class="comment"> */</span>
00043 <a class="code" href="group__apr__platform.html#ga123">APR_DECLARE</a>(apr_status_t) apr_atomic_init(apr_pool_t *p);
00044 
00045 <span class="comment">/*</span>
00046 <span class="comment"> * Atomic operations on 32-bit values</span>
00047 <span class="comment"> * Note: Each of these functions internally implements a memory barrier</span>
00048 <span class="comment"> * on platforms that require it</span>
00049 <span class="comment"> */</span>
00050 <span class="comment"></span>
00051 <span class="comment">/**</span>
00052 <span class="comment"> * atomically read an apr_uint32_t from memory</span>
00053 <span class="comment"> * @param mem the pointer</span>
00054 <span class="comment"> */</span>
00055 APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem);
00056 <span class="comment"></span>
00057 <span class="comment">/**</span>
00058 <span class="comment"> * atomically set an apr_uint32_t in memory</span>
00059 <span class="comment"> * @param mem pointer to the object</span>
00060 <span class="comment"> * @param val value that the object will assume</span>
00061 <span class="comment"> */</span>
00062 APR_DECLARE(<span class="keywordtype">void</span>) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val);
00063 <span class="comment"></span>
00064 <span class="comment">/**</span>
00065 <span class="comment"> * atomically add 'val' to an apr_uint32_t</span>
00066 <span class="comment"> * @param mem pointer to the object</span>
00067 <span class="comment"> * @param val amount to add</span>
00068 <span class="comment"> * @return old value pointed to by mem</span>
00069 <span class="comment"> */</span>
00070 APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val);
00071 <span class="comment"></span>
00072 <span class="comment">/**</span>
00073 <span class="comment"> * atomically subtract 'val' from an apr_uint32_t</span>
00074 <span class="comment"> * @param mem pointer to the object</span>
00075 <span class="comment"> * @param val amount to subtract</span>
00076 <span class="comment"> */</span>
00077 APR_DECLARE(<span class="keywordtype">void</span>) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val);
00078 <span class="comment"></span>
00079 <span class="comment">/**</span>
00080 <span class="comment"> * atomically increment an apr_uint32_t by 1</span>
00081 <span class="comment"> * @param mem pointer to the object</span>
00082 <span class="comment"> * @return old value pointed to by mem</span>
00083 <span class="comment"> */</span>
00084 APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem);
00085 <span class="comment"></span>
00086 <span class="comment">/**</span>
00087 <span class="comment"> * atomically decrement an apr_uint32_t by 1</span>
00088 <span class="comment"> * @param mem pointer to the atomic value</span>
00089 <span class="comment"> * @return zero if the value becomes zero on decrement, otherwise non-zero</span>
00090 <span class="comment"> */</span>
00091 APR_DECLARE(<span class="keywordtype">int</span>) apr_atomic_dec32(volatile apr_uint32_t *mem);
00092 <span class="comment"></span>
00093 <span class="comment">/**</span>
00094 <span class="comment"> * compare an apr_uint32_t's value with 'cmp'.</span>
00095 <span class="comment"> * If they are the same swap the value with 'with'</span>
00096 <span class="comment"> * @param mem pointer to the value</span>
00097 <span class="comment"> * @param with what to swap it with</span>
00098 <span class="comment"> * @param cmp the value to compare it to</span>
00099 <span class="comment"> * @return the old value of *mem</span>
00100 <span class="comment"> */</span>
00101 APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,
00102                               apr_uint32_t cmp);
00103 <span class="comment"></span>
00104 <span class="comment">/**</span>
00105 <span class="comment"> * exchange an apr_uint32_t's value with 'val'.</span>
00106 <span class="comment"> * @param mem pointer to the value</span>
00107 <span class="comment"> * @param val what to swap it with</span>
00108 <span class="comment"> * @return the old value of *mem</span>
00109 <span class="comment"> */</span>
00110 APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val);
00111 <span class="comment"></span>
00112 <span class="comment">/**</span>
00113 <span class="comment"> * compare the pointer's value with cmp.</span>
00114 <span class="comment"> * If they are the same swap the value with 'with'</span>
00115 <span class="comment"> * @param mem pointer to the pointer</span>
00116 <span class="comment"> * @param with what to swap it with</span>
00117 <span class="comment"> * @param cmp the value to compare it to</span>
00118 <span class="comment"> * @return the old value of the pointer</span>
00119 <span class="comment"> */</span>
00120 APR_DECLARE(<span class="keywordtype">void</span>*) apr_atomic_casptr(volatile <span class="keywordtype">void</span> **mem, <span class="keywordtype">void</span> *with, const <span class="keywordtype">void</span> *cmp);
00121 <span class="comment"></span>
00122 <span class="comment">/** @} */</span>
00123 
00124 #ifdef __cplusplus
00125 }
00126 #endif
00127 
00128 #endif  <span class="comment">/* !APR_ATOMIC_H */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Mar 20 19:52:26 2005 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.3.9.1 </small></address>
</body>
</html>