Zen API
 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 
37 {
38  *atomic = value;
39 }
40 
51 {
52  return xkAtomic32s_IncrementImpl(atomic);
53 }
54 
65 {
66  return xkAtomic32s_DecrementImpl(atomic);
67 }
68 
80 {
81  return xkAtomic32s_ExchangeImpl(atomic, value);
82 }
83 
98 {
99  return xkAtomic32s_CompareExchangeImpl(atomic, oldValue, value);
100 }
101 
112 {
113  return xkAtomic32s_GetImpl(atomic);
114 }
115 
116 #if !defined(K_WINDOWS) || defined(_WIN64)
117 
125 //typedef xkAtomic64s kAtomic64s; // --forward-declared in kApiDef.x.h
126 
138 {
139  *atomic = value;
140 }
141 
152 {
153  return xkAtomic64s_IncrementImpl(atomic);
154 }
155 
166 {
167  return xkAtomic64s_DecrementImpl(atomic);
168 }
169 
181 {
182  return xkAtomic64s_ExchangeImpl(atomic, value);
183 }
184 
199 {
200  return xkAtomic64s_CompareExchangeImpl(atomic, oldValue, value);
201 }
202 
213 {
214  return xkAtomic64s_GetImpl(atomic);
215 }
216 
217 #endif
218 
226 //typedef xkAtomicPointer kAtomicPointer; // --forward-declared in kApiDef.x.h
227 
239 {
240  *(kPointer*) atomic = value;
241 }
242 
254 {
255  return xkAtomicPointer_ExchangeImpl(atomic, value);
256 }
257 
272 {
273  return xkAtomicPointer_CompareExchangeImpl(atomic, oldValue, value);
274 }
275 
286 {
287  return xkAtomicPointer_GetImpl(atomic);
288 }
289 
290 #endif
Represents a void pointer.
k32s kAtomic32s_Increment(kAtomic32s *atomic)
Increments an atomic variable.
Definition: kAtomic.h:50
void kAtomic64s_Init(kAtomic64s *atomic, k64s value)
Initializes an atomic variable with a particular value.
Definition: kAtomic.h:137
k64s kAtomic64s_Increment(kAtomic64s *atomic)
Increments an atomic variable.
Definition: kAtomic.h:151
#define kInlineFx(TYPE)
Inline method declaration helper.
Definition: kApiDef.h:29
kBool kAtomic32s_CompareExchange(kAtomic32s *atomic, k32s oldValue, k32s value)
Conditionally exchanges the value of an atomic variable.
Definition: kAtomic.h:97
kBool kAtomicPointer_CompareExchange(kAtomicPointer *atomic, kPointer oldValue, kPointer value)
Conditionally exchanges the value of an atomic variable.
Definition: kAtomic.h:271
Represents a 64-bit, atomically-accessed, signed integer.
k64s kAtomic64s_Get(kAtomic64s *atomic)
Gets the current value of an atomic variable.
Definition: kAtomic.h:212
Represents a 32-bit, atomically-accessed, signed integer.
k64s kAtomic64s_Exchange(kAtomic64s *atomic, k64s value)
Exchanges the value of an atomic variable.
Definition: kAtomic.h:180
Core Zen type declarations.
Represents a 32-bit signed integer.
void kAtomicPointer_Init(kAtomicPointer *atomic, kPointer value)
Initializes an atomic variable with a particular value.
Definition: kAtomic.h:238
k64s kAtomic64s_Decrement(kAtomic64s *atomic)
Decrements an atomic variable.
Definition: kAtomic.h:165
Represents a 64-bit signed integer.
k32s kAtomic32s_Decrement(kAtomic32s *atomic)
Decrements an atomic variable.
Definition: kAtomic.h:64
void kAtomic32s_Init(kAtomic32s *atomic, k32s value)
Initializes an atomic variable with a particular value.
Definition: kAtomic.h:36
Represents an atomically-accessed pointer.
Represents a boolean value.
k32s kAtomic32s_Exchange(kAtomic32s *atomic, k32s value)
Exchanges the value of an atomic variable.
Definition: kAtomic.h:79
kPointer kAtomicPointer_Exchange(kAtomicPointer *atomic, kPointer value)
Exchanges the value of an atomic variable.
Definition: kAtomic.h:253
k32s kAtomic32s_Get(kAtomic32s *atomic)
Gets the current value of an atomic variable.
Definition: kAtomic.h:111
kBool kAtomic64s_CompareExchange(kAtomic64s *atomic, k64s oldValue, k64s value)
Conditionally exchanges the value of an atomic variable.
Definition: kAtomic.h:198
kPointer kAtomicPointer_Get(kAtomicPointer *atomic)
Gets the current value of an atomic variable.
Definition: kAtomic.h:285