GDAL

cpl_atomic_ops.h
1/**********************************************************************
2 * $Id$
3 *
4 * Name: cpl_atomic_ops.h
5 * Project: CPL - Common Portability Library
6 * Purpose: Atomic operation functions.
7 * Author: Even Rouault, <even dot rouault at spatialys.com>
8 *
9 **********************************************************************
10 * Copyright (c) 2009-2010, Even Rouault <even dot rouault at spatialys.com>
11 *
12 * SPDX-License-Identifier: MIT
13 ****************************************************************************/
14
15#ifndef CPL_ATOMIC_OPS_INCLUDED
16#define CPL_ATOMIC_OPS_INCLUDED
17
18#include "cpl_port.h"
19
20 CPL_C_START
21
45 int CPL_DLL CPLAtomicAdd(volatile int *ptr, int increment);
46
56#define CPLAtomicInc(ptr) CPLAtomicAdd(ptr, 1)
57
67#define CPLAtomicDec(ptr) CPLAtomicAdd(ptr, -1)
68
86 int CPLAtomicCompareAndExchange(volatile int *ptr, int oldval, int newval);
87
88 CPL_C_END
89
90#endif /* CPL_ATOMIC_OPS_INCLUDED */
cpl_port.h
Core portability definitions for CPL.
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition cpl_port.h:283
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition cpl_port.h:279