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

Atomic long. More...

Typedefs

typedef struct PlankAtomicL * PlankAtomicLRef
 An opaque reference to the Plank AtomicL object (atomic long integer).

Functions

PlankAtomicLRef pl_AtomicL_CreateAndInit ()
 Creates and initialises a Plank AtomicL object and return an oqaque reference to it.
PlankAtomicLRef pl_AtomicL_Create ()
 Create a Plank AtomicL object and return an oqaque reference to it.
static PlankResult pl_AtomicL_Init (PlankAtomicLRef p)
 Initialise a Plank AtomicL object.
static PlankResult pl_AtomicL_DeInit (PlankAtomicLRef p)
 Deinitialise a Plank AtomicL object.
PlankResult pl_AtomicL_Destroy (PlankAtomicLRef p)
 Destroy a Plank AtomicL object.
static PlankL pl_AtomicL_Get (PlankAtomicLRef p)
 Get the current value.
static PlankL pl_AtomicL_GetUnchecked (PlankAtomicLRef p)
 Get the current value nonatomically.
PlankUL pl_AtomicL_GetExtra (PlankAtomicLRef p)
 Not used for this class.
PlankUL pl_AtomicL_GetExtraUnchecked (PlankAtomicLRef p)
 Not used for this class.
static PlankL pl_AtomicL_Swap (PlankAtomicLRef p, PlankL newValue)
 Swap the current value with a new value.
static void pl_AtomicL_SwapOther (PlankAtomicLRef p1, PlankAtomicLRef p2)
 Swap over two values.
static void pl_AtomicL_Set (PlankAtomicLRef p, PlankL newValue)
 Set the current value to a new value.
static PlankL pl_AtomicL_Add (PlankAtomicLRef p, PlankL operand)
 Add a value to the current value.
static PlankL pl_AtomicL_Subtract (PlankAtomicLRef p, PlankL operand)
 Subtract a value from the current value.
static PlankL pl_AtomicL_Increment (PlankAtomicLRef p)
 Increment the current value by 1.
static PlankL pl_AtomicL_Decrement (PlankAtomicLRef p)
 Decrement the current value by 1.
static PlankB pl_AtomicL_CompareAndSwap (PlankAtomicLRef p, PlankL oldValue, PlankL newValue)
 Swap the current value with a new value if a specified old value is still the current value.

Detailed Description

Atomic long.

This will be a 32-bit integer on 32-bit systems and a 64-bit integer on 64-bt systems on all Plank-supported platforms (even on Windows where a long is normally 32 bits on both architectures).


Typedef Documentation

typedef struct PlankAtomicL* PlankAtomicLRef

An opaque reference to the Plank AtomicL object (atomic long integer).


Function Documentation

static PlankL pl_AtomicL_Add ( PlankAtomicLRef  p,
PlankL  operand 
) [static]

Add a value to the current value.

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

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

Returns:
A Plank AtomicL object as an opaque reference or PLANK_NULL.
PlankAtomicLRef pl_AtomicL_CreateAndInit ( )

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

Returns:
A Plank AtomicL object as an opaque reference or PLANK_NULL.
static PlankL pl_AtomicL_Decrement ( PlankAtomicLRef  p) [static]

Decrement the current value by 1.

Parameters:
pThe Plank AtomicL object.
Returns:
The new value.
static PlankResult pl_AtomicL_DeInit ( PlankAtomicLRef  p) [inline, static]

Deinitialise a Plank AtomicL object.

Parameters:
pThe Plank AtomicL object.
Returns:
PlankResult_OK if successful, otherwise an error code.
PlankResult pl_AtomicL_Destroy ( PlankAtomicLRef  p)

Destroy a Plank AtomicL object.

Parameters:
pThe Plank AtomicL object.
Returns:
PlankResult_OK if successful, otherwise an error code.
static PlankL pl_AtomicL_Get ( PlankAtomicLRef  p) [static]

Get the current value.

Parameters:
pThe Plank AtomicL object.
Returns:
The value.
PlankUL pl_AtomicL_GetExtra ( PlankAtomicLRef  p)

Not used for this class.

Parameters:
pThe Plank AtomicL object.
Returns:
Always returns 0.
PlankUL pl_AtomicL_GetExtraUnchecked ( PlankAtomicLRef  p)

Not used for this class.

Parameters:
pThe Plank AtomicL object.
Returns:
Always returns 0.
static PlankL pl_AtomicL_GetUnchecked ( PlankAtomicLRef  p) [static]

Get the current value nonatomically.

Parameters:
pThe Plank AtomicL object.
Returns:
The value.
static PlankL pl_AtomicL_Increment ( PlankAtomicLRef  p) [static]

Increment the current value by 1.

Parameters:
pThe Plank AtomicL object.
Returns:
The new value.
static PlankResult pl_AtomicL_Init ( PlankAtomicLRef  p) [inline, static]

Initialise a Plank AtomicL object.

Parameters:
pThe Plank AtomicL object.
Returns:
PlankResult_OK if successful, otherwise an error code.
static void pl_AtomicL_Set ( PlankAtomicLRef  p,
PlankL  newValue 
) [static]

Set the current value to a new value.

Parameters:
pThe Plank AtomicL object.
newValueThe new value to store.
static PlankL pl_AtomicL_Subtract ( PlankAtomicLRef  p,
PlankL  operand 
) [static]

Subtract a value from the current value.

Parameters:
pThe Plank AtomicL object.
operandThe value to subtract.
Returns:
The new value.
static PlankL pl_AtomicL_Swap ( PlankAtomicLRef  p,
PlankL  newValue 
) [static]

Swap the current value with a new value.

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