cpl_atomic_ops.h

00001 /**********************************************************************
00002  * $Id: cpl_atomic_ops.h 27044 2014-03-16 23:41:27Z rouault $
00003  *
00004  * Name:     cpl_atomic_ops.h
00005  * Project:  CPL - Common Portability Library
00006  * Purpose:  Atomic operation functions.
00007  * Author:   Even Rouault, <even dot rouault at mines dash paris dot org>
00008  *
00009  **********************************************************************
00010  * Copyright (c) 2009-2010, Even Rouault <even dot rouault at mines-paris dot org>
00011  *
00012  * Permission is hereby granted, free of charge, to any person obtaining a
00013  * copy of this software and associated documentation files (the "Software"),
00014  * to deal in the Software without restriction, including without limitation
00015  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00016  * and/or sell copies of the Software, and to permit persons to whom the
00017  * Software is furnished to do so, subject to the following conditions:
00018  * 
00019  * The above copyright notice and this permission notice shall be included
00020  * in all copies or substantial portions of the Software.
00021  * 
00022  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00023  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00024  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00025  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00026  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00027  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
00028  * DEALINGS IN THE SOFTWARE.
00029  ****************************************************************************/
00030 
00031 #ifndef _CPL_ATOMIC_OPS_INCLUDED
00032 #define _CPL_ATOMIC_OPS_INCLUDED
00033 
00034 #include "cpl_port.h"
00035 
00036 CPL_C_START
00037 
00061 int CPL_DLL CPLAtomicAdd(volatile int* ptr, int increment);
00062 
00072 #ifdef HAS_CPL_INLINE
00073 CPL_INLINE int CPLAtomicInc(volatile int* ptr)
00074 {
00075     return CPLAtomicAdd(ptr, 1);
00076 }
00077 #else
00078 int CPL_DLL CPLAtomicInc(volatile int* ptr);
00079 #endif
00080 
00090 #ifdef HAS_CPL_INLINE
00091 CPL_INLINE int CPLAtomicDec(volatile int* ptr)
00092 {
00093     return CPLAtomicAdd(ptr, -1);
00094 }
00095 #else
00096 int CPL_DLL CPLAtomicDec(volatile int* ptr);
00097 #endif
00098 
00099 CPL_C_END
00100 
00101 #endif /* _CPL_ATOMIC_OPS_INCLUDED */

Generated for GDAL by doxygen 1.7.1.