![]() |
pl-nk v0.4.5
Plonk|Plink|Plank are a set of cross-platform C/C++ frameworks for audio software development
|
Atomic integer. More...
Typedefs | |
typedef struct PlankAtomicI * | PlankAtomicIRef |
An opaque reference to the Plank AtomicI object (atomic 32-bit integer). | |
Functions | |
PlankAtomicIRef | pl_AtomicI_CreateAndInit () |
Creates and initialises a Plank AtomicI object and return an oqaque reference to it. | |
PlankAtomicIRef | pl_AtomicI_Create () |
Create a Plank AtomicI object and return an oqaque reference to it. | |
static PlankResult | pl_AtomicI_Init (PlankAtomicIRef p) |
Initialise a Plank AtomicI object. | |
static PlankResult | pl_AtomicI_DeInit (PlankAtomicIRef p) |
Deinitialise a Plank AtomicI object. | |
PlankResult | pl_AtomicI_Destroy (PlankAtomicIRef p) |
Destroy a Plank AtomicI object. | |
static PlankI | pl_AtomicI_Get (PlankAtomicIRef p) |
Get the current value. | |
static PlankI | pl_AtomicI_GetUnchecked (PlankAtomicIRef p) |
Get the current value nonatomically. | |
PlankUI | pl_AtomicI_GetExtra (PlankAtomicIRef p) |
Not used for this class. | |
PlankUI | pl_AtomicI_GetExtraUnchecked (PlankAtomicIRef p) |
Not used for this class. | |
static PlankI | pl_AtomicI_Swap (PlankAtomicIRef p, PlankI newValue) |
Swap the current value with a new value. | |
static void | pl_AtomicI_SwapOther (PlankAtomicIRef p1, PlankAtomicIRef p2) |
Swap over two values. | |
static void | pl_AtomicI_Set (PlankAtomicIRef p, PlankI newValue) |
Set the current value to a new value. | |
static PlankI | pl_AtomicI_Add (PlankAtomicIRef p, PlankI operand) |
Add a value to the current value. | |
static PlankI | pl_AtomicI_Subtract (PlankAtomicIRef p, PlankI operand) |
Subtract a value from the current value. | |
static PlankI | pl_AtomicI_Increment (PlankAtomicIRef p) |
Increment the current value by 1. | |
static PlankI | pl_AtomicI_Decrement (PlankAtomicIRef p) |
Decrement the current value by 1. | |
static PlankB | pl_AtomicI_CompareAndSwap (PlankAtomicIRef p, PlankI oldValue, PlankI newValue) |
Swap the current value with a new value if a specified old value is still the current value. |
Atomic integer.
This will be a 32-bit integer on all Plank-supported platforms.
typedef struct PlankAtomicI* PlankAtomicIRef |
An opaque reference to the Plank AtomicI object (atomic 32-bit integer).
static PlankI pl_AtomicI_Add | ( | PlankAtomicIRef | p, |
PlankI | operand | ||
) | [static] |
Add a value to the current value.
p | The Plank AtomicI object. |
operand | The value to add. |
static PlankB pl_AtomicI_CompareAndSwap | ( | PlankAtomicIRef | p, |
PlankI | oldValue, | ||
PlankI | newValue | ||
) | [static] |
Swap the current value with a new value if a specified old value is still the current value.
This is the most important atomic operation for each atomic class, many other operations are based on this. If the operation fails the user would generally try again by getting the old value again and retrying to write the new value (e.g., in a loop) until successful. If there are no other threads contending to write the value the operation should succeed without blocking.
p | The Plank AtomicI object. |
oldValue | The expected old value being currently stored. |
newValue | The new value to attempt to store. |
true
if the swap was successful, otherwise false
. PlankAtomicIRef pl_AtomicI_Create | ( | ) |
Create a Plank AtomicI object and return an oqaque reference to it.
PlankAtomicIRef pl_AtomicI_CreateAndInit | ( | ) |
Creates and initialises a Plank AtomicI object and return an oqaque reference to it.
static PlankI pl_AtomicI_Decrement | ( | PlankAtomicIRef | p | ) | [static] |
Decrement the current value by 1.
p | The Plank AtomicI object. |
static PlankResult pl_AtomicI_DeInit | ( | PlankAtomicIRef | p | ) | [inline, static] |
Deinitialise a Plank AtomicI object.
p | The Plank AtomicI object. |
PlankResult pl_AtomicI_Destroy | ( | PlankAtomicIRef | p | ) |
Destroy a Plank AtomicI object.
p | The Plank AtomicI object. |
static PlankI pl_AtomicI_Get | ( | PlankAtomicIRef | p | ) | [static] |
Get the current value.
This is done by adding zero to the current value and returning the result.
p | The Plank AtomicI object. |
PlankUI pl_AtomicI_GetExtra | ( | PlankAtomicIRef | p | ) |
Not used for this class.
p | The Plank AtomicI object. |
PlankUI pl_AtomicI_GetExtraUnchecked | ( | PlankAtomicIRef | p | ) |
Not used for this class.
p | The Plank AtomicI object. |
static PlankI pl_AtomicI_GetUnchecked | ( | PlankAtomicIRef | p | ) | [static] |
Get the current value nonatomically.
p | The Plank AtomicI object. |
static PlankI pl_AtomicI_Increment | ( | PlankAtomicIRef | p | ) | [static] |
Increment the current value by 1.
p | The Plank AtomicI object. |
static PlankResult pl_AtomicI_Init | ( | PlankAtomicIRef | p | ) | [inline, static] |
Initialise a Plank AtomicI object.
p | The Plank AtomicI object. |
static void pl_AtomicI_Set | ( | PlankAtomicIRef | p, |
PlankI | newValue | ||
) | [static] |
Set the current value to a new value.
p | The Plank AtomicI object. |
newValue | The new value to store. |
static PlankI pl_AtomicI_Subtract | ( | PlankAtomicIRef | p, |
PlankI | operand | ||
) | [static] |
Subtract a value from the current value.
p | The Plank AtomicI object. |
operand | The value to subtract. |
static PlankI pl_AtomicI_Swap | ( | PlankAtomicIRef | p, |
PlankI | newValue | ||
) | [static] |
Swap the current value with a new value.
p | The Plank AtomicI object. |
newValue | The new value to store. |
static void pl_AtomicI_SwapOther | ( | PlankAtomicIRef | p1, |
PlankAtomicIRef | p2 | ||
) | [static] |
Swap over two values.
The contents of p1 is copied to p2 and p2 is copied to p1 in an atomic operation.
p1 | One Plank AtomicI object. |
p2 | The other Plank AtomicI object. |