AlterOffice
AlterOffice 3.4 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
interlck.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 
4 #ifndef INCLUDED_OSL_INTERLCK_H
5 #define INCLUDED_OSL_INTERLCK_H
6 
7 #include "sal/config.h"
8 
9 #include "sal/saldllapi.h"
10 #include "sal/types.h"
11 
12 #if defined(_WIN32)
13 #include <intrin.h>
14 #endif
15 
16 #if defined LIBO_INTERNAL_ONLY
17 #include "config_global.h"
18 #endif
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 typedef sal_Int32 oslInterlockedCount;
25 
30 SAL_DLLPUBLIC oslInterlockedCount SAL_CALL osl_incrementInterlockedCount(oslInterlockedCount* pCount);
31 
36 SAL_DLLPUBLIC oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount* pCount);
37 
38 
40 
51 #if HAVE_GCC_BUILTIN_ATOMIC
52 # define osl_atomic_increment(p) __sync_add_and_fetch((p), 1)
53 #elif defined WNT
54 # define osl_atomic_increment(p) _InterlockedIncrement(p)
55 #else
56 # define osl_atomic_increment(p) osl_incrementInterlockedCount((p))
57 #endif
58 
59 
70 #if HAVE_GCC_BUILTIN_ATOMIC
71 # define osl_atomic_decrement(p) __sync_sub_and_fetch((p), 1)
72 #elif defined WNT
73 # define osl_atomic_decrement(p) _InterlockedDecrement(p)
74 #else
75 # define osl_atomic_decrement(p) osl_decrementInterlockedCount((p))
76 #endif
77 
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 
85 #endif // INCLUDED_OSL_INTERLCK_H
86 
87 
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC oslInterlockedCount osl_decrementInterlockedCount(oslInterlockedCount *pCount)
Decrement the count variable addressed by pCount.
sal_Int32 oslInterlockedCount
Definition: interlck.h:24
SAL_DLLPUBLIC oslInterlockedCount osl_incrementInterlockedCount(oslInterlockedCount *pCount)
Increments the count variable addressed by pCount.
#define SAL_DLLPUBLIC
Definition: saldllapi.h:14