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 xkAtomicPointer kAtomicPointer; // --forward-declared in kApiDef.x.h
124 
136 {
137  *(kPointer*) atomic = value;
138 }
139 
151 {
152  return xkAtomicPointer_ExchangeImpl(atomic, value);
153 }
154 
169 {
170  return xkAtomicPointer_CompareExchangeImpl(atomic, oldValue, value);
171 }
172 
183 {
184  return xkAtomicPointer_GetImpl(atomic);
185 }
186 
187 #endif
Represents a void pointer.
k32s kAtomic32s_Increment(kAtomic32s *atomic)
Increments an atomic variable.
Definition: kAtomic.h:50
#define kInlineFx(TYPE)
Inline method declaration helper.
Definition: kApiDef.h:26
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:168
Represents a 32-bit, atomically-accessed, signed integer.
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:135
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:150
k32s kAtomic32s_Get(kAtomic32s *atomic)
Gets the current value of an atomic variable.
Definition: kAtomic.h:111
kPointer kAtomicPointer_Get(kAtomicPointer *atomic)
Gets the current value of an atomic variable.
Definition: kAtomic.h:182