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 
123 //typedef xkAtomic64s kAtomic64s; // --forward-declared in kApiDef.x.h
124 
136 {
137  *atomic = value;
138 }
139 
150 {
151  return xkAtomic64s_IncrementImpl(atomic);
152 }
153 
164 {
165  return xkAtomic64s_DecrementImpl(atomic);
166 }
167 
179 {
180  return xkAtomic64s_ExchangeImpl(atomic, value);
181 }
182 
197 {
198  return xkAtomic64s_CompareExchangeImpl(atomic, oldValue, value);
199 }
200 
211 {
212  return xkAtomic64s_GetImpl(atomic);
213 }
214 
222 //typedef xkAtomicPointer kAtomicPointer; // --forward-declared in kApiDef.x.h
223 
235 {
236  *(kPointer*) atomic = value;
237 }
238 
250 {
251  return xkAtomicPointer_ExchangeImpl(atomic, value);
252 }
253 
268 {
269  return xkAtomicPointer_CompareExchangeImpl(atomic, oldValue, value);
270 }
271 
282 {
283  return xkAtomicPointer_GetImpl(atomic);
284 }
285 
286 #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:135
k64s kAtomic64s_Increment(kAtomic64s *atomic)
Increments an atomic variable.
Definition: kAtomic.h:149
#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:267
Represents a 64-bit, atomically-accessed, signed integer.
k64s kAtomic64s_Get(kAtomic64s *atomic)
Gets the current value of an atomic variable.
Definition: kAtomic.h:210
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:178
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:234
k64s kAtomic64s_Decrement(kAtomic64s *atomic)
Decrements an atomic variable.
Definition: kAtomic.h:163
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:249
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:196
kPointer kAtomicPointer_Get(kAtomicPointer *atomic)
Gets the current value of an atomic variable.
Definition: kAtomic.h:281