pl-nk v0.4.5
Plonk|Plink|Plank are a set of cross-platform C/C++ frameworks for audio software development
Typedefs | Functions
Plank AtomicI class
Plank Atomic operation classes

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.

Detailed Description

Atomic integer.

This will be a 32-bit integer on all Plank-supported platforms.


Typedef Documentation

typedef struct PlankAtomicI* PlankAtomicIRef

An opaque reference to the Plank AtomicI object (atomic 32-bit integer).


Function Documentation

static PlankI pl_AtomicI_Add ( PlankAtomicIRef  p,
PlankI  operand 
) [static]

Add a value to the current value.

Parameters:
pThe Plank AtomicI object.
operandThe value to add.
Returns:
The new value.
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.

Parameters:
pThe Plank AtomicI object.
oldValueThe expected old value being currently stored.
newValueThe new value to attempt to store.
Returns:
true if the swap was successful, otherwise false.
PlankAtomicIRef pl_AtomicI_Create ( )

Create a Plank AtomicI object and return an oqaque reference to it.

Returns:
A Plank AtomicI object as an opaque reference or PLANK_NULL.
PlankAtomicIRef pl_AtomicI_CreateAndInit ( )

Creates and initialises a Plank AtomicI object and return an oqaque reference to it.

Returns:
A Plank AtomicI object as an opaque reference or PLANK_NULL.
static PlankI pl_AtomicI_Decrement ( PlankAtomicIRef  p) [static]

Decrement the current value by 1.

Parameters:
pThe Plank AtomicI object.
Returns:
The new value.
static PlankResult pl_AtomicI_DeInit ( PlankAtomicIRef  p) [inline, static]

Deinitialise a Plank AtomicI object.

Parameters:
pThe Plank AtomicI object.
Returns:
PlankResult_OK if successful, otherwise an error code.
PlankResult pl_AtomicI_Destroy ( PlankAtomicIRef  p)

Destroy a Plank AtomicI object.

Parameters:
pThe Plank AtomicI object.
Returns:
PlankResult_OK if successful, otherwise an error code.
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.

Parameters:
pThe Plank AtomicI object.
Returns:
The value.
PlankUI pl_AtomicI_GetExtra ( PlankAtomicIRef  p)

Not used for this class.

Parameters:
pThe Plank AtomicI object.
Returns:
Always returns 0.
PlankUI pl_AtomicI_GetExtraUnchecked ( PlankAtomicIRef  p)

Not used for this class.

Parameters:
pThe Plank AtomicI object.
Returns:
Always returns 0.
static PlankI pl_AtomicI_GetUnchecked ( PlankAtomicIRef  p) [static]

Get the current value nonatomically.

Parameters:
pThe Plank AtomicI object.
Returns:
The value.
static PlankI pl_AtomicI_Increment ( PlankAtomicIRef  p) [static]

Increment the current value by 1.

Parameters:
pThe Plank AtomicI object.
Returns:
The new value.
static PlankResult pl_AtomicI_Init ( PlankAtomicIRef  p) [inline, static]

Initialise a Plank AtomicI object.

Parameters:
pThe Plank AtomicI object.
Returns:
PlankResult_OK if successful, otherwise an error code.
static void pl_AtomicI_Set ( PlankAtomicIRef  p,
PlankI  newValue 
) [static]

Set the current value to a new value.

Parameters:
pThe Plank AtomicI object.
newValueThe new value to store.
static PlankI pl_AtomicI_Subtract ( PlankAtomicIRef  p,
PlankI  operand 
) [static]

Subtract a value from the current value.

Parameters:
pThe Plank AtomicI object.
operandThe value to subtract.
Returns:
The new value.
static PlankI pl_AtomicI_Swap ( PlankAtomicIRef  p,
PlankI  newValue 
) [static]

Swap the current value with a new value.

Parameters:
pThe Plank AtomicI object.
newValueThe new value to store.
Returns:
The previously stored value.
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.

Parameters:
p1One Plank AtomicI object.
p2The other Plank AtomicI object.
 All Classes Functions Typedefs Enumerations Enumerator Properties