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

Atomic long long. More...

Typedefs

typedef struct PlankAtomicLL * PlankAtomicLLRef
 An opaque reference to the Plank AtomicLL object (atomic 64-bit integer).

Functions

PlankAtomicLLRef pl_AtomicLL_CreateAndInit ()
 Creates and initialises a Plank AtomicLL object and return an oqaque reference to it.
PlankAtomicLLRef pl_AtomicLL_Create ()
 Create a Plank AtomicLL object and return an oqaque reference to it.
static PlankResult pl_AtomicLL_Init (PlankAtomicLLRef p)
 Initialise a Plank AtomicLL object.
static PlankResult pl_AtomicLL_DeInit (PlankAtomicLLRef p)
 Deinitialise a Plank AtomicLL object.
PlankResult pl_AtomicLL_Destroy (PlankAtomicLLRef p)
 Destroy a Plank AtomicLL object.
static PlankLL pl_AtomicLL_Get (PlankAtomicLLRef p)
 Get the current value.
static PlankLL pl_AtomicLL_GetUnchecked (PlankAtomicLLRef p)
 Get the current value nonatomically.
PlankULL pl_AtomicLL_GetExtra (PlankAtomicLLRef p)
 Not used for this class.
PlankULL pl_AtomicLL_GetExtraUnchecked (PlankAtomicLLRef p)
 Not used for this class.
static PlankLL pl_AtomicLL_Swap (PlankAtomicLLRef p, PlankLL newValue)
 Swap the current value with a new value.
static void pl_AtomicLL_SwapOther (PlankAtomicLLRef p1, PlankAtomicLLRef p2)
 Swap over two values.
static void pl_AtomicLL_Set (PlankAtomicLLRef p, PlankLL newValue)
 Set the current value to a new value.
static PlankLL pl_AtomicLL_Add (PlankAtomicLLRef p, PlankLL operand)
 Add a value to the current value.
static PlankLL pl_AtomicLL_Subtract (PlankAtomicLLRef p, PlankLL operand)
 Subtract a value from the current value.
static PlankLL pl_AtomicLL_Increment (PlankAtomicLLRef p)
 Increment the current value by 1.
static PlankLL pl_AtomicLL_Decrement (PlankAtomicLLRef p)
 Decrement the current value by 1.
static PlankB pl_AtomicLL_CompareAndSwap (PlankAtomicLLRef p, PlankLL oldValue, PlankLL newValue)
 Swap the current value with a new value if a specified old value is still the current value.

Detailed Description

Atomic long long.

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

On PPC on Mac OS this is not a truly lock-free operations, it uses a lock due to the absence of 64-bit atomic operations.


Typedef Documentation

typedef struct PlankAtomicLL* PlankAtomicLLRef

An opaque reference to the Plank AtomicLL object (atomic 64-bit integer).


Function Documentation

static PlankLL pl_AtomicLL_Add ( PlankAtomicLLRef  p,
PlankLL  operand 
) [static]

Add a value to the current value.

Parameters:
pThe Plank AtomicLL object.
operandThe value to add.
Returns:
The new value.
static PlankB pl_AtomicLL_CompareAndSwap ( PlankAtomicLLRef  p,
PlankLL  oldValue,
PlankLL  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 AtomicLL object.
oldValueThe expected old value being currently stored.
newValueThe new value to attempt to store.
Returns:
true if the swap was successful, otherwise false.
PlankAtomicLLRef pl_AtomicLL_Create ( )

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

Returns:
A Plank AtomicLL object as an opaque reference or PLANK_NULL.
PlankAtomicLLRef pl_AtomicLL_CreateAndInit ( )

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

Returns:
A Plank AtomicLL object as an opaque reference or PLANK_NULL.
static PlankLL pl_AtomicLL_Decrement ( PlankAtomicLLRef  p) [static]

Decrement the current value by 1.

Parameters:
pThe Plank AtomicLL object.
Returns:
The new value.
static PlankResult pl_AtomicLL_DeInit ( PlankAtomicLLRef  p) [static]

Deinitialise a Plank AtomicLL object.

Parameters:
pThe Plank AtomicLL object.
Returns:
PlankResult_OK if successful, otherwise an error code.
PlankResult pl_AtomicLL_Destroy ( PlankAtomicLLRef  p)

Destroy a Plank AtomicLL object.

Parameters:
pThe Plank AtomicLL object.
Returns:
PlankResult_OK if successful, otherwise an error code.
static PlankLL pl_AtomicLL_Get ( PlankAtomicLLRef  p) [static]

Get the current value.

Parameters:
pThe Plank AtomicLL object.
Returns:
The value.
PlankULL pl_AtomicLL_GetExtra ( PlankAtomicLLRef  p)

Not used for this class.

Parameters:
pThe Plank AtomicLL object.
Returns:
Always returns 0.
PlankULL pl_AtomicLL_GetExtraUnchecked ( PlankAtomicLLRef  p)

Not used for this class.

Parameters:
pThe Plank AtomicLL object.
Returns:
Always returns 0.
static PlankLL pl_AtomicLL_GetUnchecked ( PlankAtomicLLRef  p) [static]

Get the current value nonatomically.

Parameters:
pThe Plank AtomicLL object.
Returns:
The value.
static PlankLL pl_AtomicLL_Increment ( PlankAtomicLLRef  p) [static]

Increment the current value by 1.

Parameters:
pThe Plank AtomicLL object.
Returns:
The new value.
static PlankResult pl_AtomicLL_Init ( PlankAtomicLLRef  p) [static]

Initialise a Plank AtomicLL object.

Parameters:
pThe Plank AtomicLL object.
Returns:
PlankResult_OK if successful, otherwise an error code.
static void pl_AtomicLL_Set ( PlankAtomicLLRef  p,
PlankLL  newValue 
) [static]

Set the current value to a new value.

Parameters:
pThe Plank AtomicLL object.
newValueThe new value to store.
static PlankLL pl_AtomicLL_Subtract ( PlankAtomicLLRef  p,
PlankLL  operand 
) [static]

Subtract a value from the current value.

Parameters:
pThe Plank AtomicLL object.
operandThe value to subtract.
Returns:
The new value.
static PlankLL pl_AtomicLL_Swap ( PlankAtomicLLRef  p,
PlankLL  newValue 
) [static]

Swap the current value with a new value.

Parameters:
pThe Plank AtomicLL object.
newValueThe new value to store.
Returns:
The previously stored value.
static void pl_AtomicLL_SwapOther ( PlankAtomicLLRef  p1,
PlankAtomicLLRef  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 AtomicLL object.
p2The other Plank AtomicLL object.
 All Classes Functions Typedefs Enumerations Enumerator Properties