Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kAtomic.h
Go to the documentation of this file.
1
10 #include <kApi/kApiDef.h> //--inclusion order controlled by kApiDef
11
12 #ifndef K_API_ATOMIC_H
13 #define K_API_ATOMIC_H
14
15 #include <kApi/Threads/kAtomic.x.h>
16
24 //typedef xkAtomic32s kAtomic32s; // --forward-declared in kApiDef.x.h
25
36 kInlineFx(void) kAtomic32s_Init(kAtomic32s* atomic, k32s value)
37 {
38 *atomic = value;
39 }
40
50 kInlineFx(k32s) kAtomic32s_Increment(kAtomic32s* atomic)
51 {
52 return xkAtomic32s_IncrementImpl(atomic);
53 }
54
64 kInlineFx(k32s) kAtomic32s_Decrement(kAtomic32s* atomic)
65 {
66 return xkAtomic32s_DecrementImpl(atomic);
67 }
68
79 kInlineFx(k32s) kAtomic32s_Exchange(kAtomic32s* atomic, k32s value)
80 {
81 return xkAtomic32s_ExchangeImpl(atomic, value);
82 }
83
97 kInlineFx(kBool) kAtomic32s_CompareExchange(kAtomic32s* atomic, k32s oldValue, k32s value)
98 {
99 return xkAtomic32s_CompareExchangeImpl(atomic, oldValue, value);
100 }
101
111 kInlineFx(k32s) kAtomic32s_Get(kAtomic32s* atomic)
112 {
113 return xkAtomic32s_GetImpl(atomic);
114 }
115
123 //typedef xkAtomicPointer kAtomicPointer; // --forward-declared in kApiDef.x.h
124
135 kInlineFx(void) kAtomicPointer_Init(kAtomicPointer* atomic, kPointer value)
136 {
137 *(kPointer*) atomic = value;
138 }
139
150 kInlineFx(kPointer) kAtomicPointer_Exchange(kAtomicPointer* atomic, kPointer value)
151 {
152 return xkAtomicPointer_ExchangeImpl(atomic, value);
153 }
154
168 kInlineFx(kBool) kAtomicPointer_CompareExchange(kAtomicPointer* atomic, kPointer oldValue, kPointer value)
169 {
170 return xkAtomicPointer_CompareExchangeImpl(atomic, oldValue, value);
171 }
172
182 kInlineFx(kPointer) kAtomicPointer_Get(kAtomicPointer* atomic)
183 {
184 return xkAtomicPointer_GetImpl(atomic);
185 }
186
187 #endif
kPointer
Represents a void pointer.
kAtomic32s::kAtomic32s_Increment
k32s kAtomic32s_Increment(kAtomic32s *atomic)
Increments an atomic variable.
Definition: kAtomic.h:50
kInlineFx
#define kInlineFx(TYPE)
Inline method declaration helper.
Definition: kApiDef.h:26
kAtomic32s::kAtomic32s_CompareExchange
kBool kAtomic32s_CompareExchange(kAtomic32s *atomic, k32s oldValue, k32s value)
Conditionally exchanges the value of an atomic variable.
Definition: kAtomic.h:97
kAtomicPointer::kAtomicPointer_CompareExchange
kBool kAtomicPointer_CompareExchange(kAtomicPointer *atomic, kPointer oldValue, kPointer value)
Conditionally exchanges the value of an atomic variable.
Definition: kAtomic.h:168
kAtomic32s
Represents a 32-bit, atomically-accessed, signed integer.
kApiDef.h
Core Zen type declarations.
k32s
Represents a 32-bit signed integer.
kAtomicPointer::kAtomicPointer_Init
void kAtomicPointer_Init(kAtomicPointer *atomic, kPointer value)
Initializes an atomic variable with a particular value.
Definition: kAtomic.h:135
kAtomic32s::kAtomic32s_Decrement
k32s kAtomic32s_Decrement(kAtomic32s *atomic)
Decrements an atomic variable.
Definition: kAtomic.h:64
kAtomic32s::kAtomic32s_Init
void kAtomic32s_Init(kAtomic32s *atomic, k32s value)
Initializes an atomic variable with a particular value.
Definition: kAtomic.h:36
kAtomicPointer
Represents an atomically-accessed pointer.
kBool
Represents a boolean value.
kAtomic32s::kAtomic32s_Exchange
k32s kAtomic32s_Exchange(kAtomic32s *atomic, k32s value)
Exchanges the value of an atomic variable.
Definition: kAtomic.h:79
kAtomicPointer::kAtomicPointer_Exchange
kPointer kAtomicPointer_Exchange(kAtomicPointer *atomic, kPointer value)
Exchanges the value of an atomic variable.
Definition: kAtomic.h:150
kAtomic32s::kAtomic32s_Get
k32s kAtomic32s_Get(kAtomic32s *atomic)
Gets the current value of an atomic variable.
Definition: kAtomic.h:111
kAtomicPointer::kAtomicPointer_Get
kPointer kAtomicPointer_Get(kAtomicPointer *atomic)
Gets the current value of an atomic variable.
Definition: kAtomic.h:182