GME  13
apr_atomic.h
Go to the documentation of this file.
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef APR_ATOMIC_H
00018 #define APR_ATOMIC_H
00019 
00025 #include "apr.h"
00026 #include "apr_pools.h"
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00047 APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p);
00048 
00049 /*
00050  * Atomic operations on 32-bit values
00051  * Note: Each of these functions internally implements a memory barrier
00052  * on platforms that require it
00053  */
00054 
00059 APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem);
00060 
00066 APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val);
00067 
00074 APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val);
00075 
00081 APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val);
00082 
00088 APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem);
00089 
00095 APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem);
00096 
00105 APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,
00106                               apr_uint32_t cmp);
00107 
00114 APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val);
00115 
00124 APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp);
00125 
00132 APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with);
00133 
00136 #ifdef __cplusplus
00137 }
00138 #endif
00139 
00140 #endif  /* !APR_ATOMIC_H */