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

Atomic pointer. More...

Typedefs

typedef struct PlankAtomicP * PlankAtomicPRef
 An opaque reference to the Plank AtomicP object (atomic pointer).

Functions

PlankAtomicPRef pl_AtomicP_CreateAndInit ()
 Creates and initialises a Plank AtomicP object and return an oqaque reference to it.
PlankAtomicPRef pl_AtomicP_Create ()
 Create a Plank AtomicD object and return an oqaque reference to it.
static PlankResult pl_AtomicP_Init (PlankAtomicPRef p)
 Initialise a Plank AtomicP object.
static PlankResult pl_AtomicP_DeInit (PlankAtomicPRef p)
 Deinitialise a Plank AtomicP object.
PlankResult pl_AtomicP_Destroy (PlankAtomicPRef p)
 Destroy a Plank AtomicP object.
static PlankP pl_AtomicP_Get (PlankAtomicPRef p)
 Get the current value.
static PlankP pl_AtomicP_GetUnchecked (PlankAtomicPRef p)
 Get the current value nonatomically.
PlankUL pl_AtomicP_GetExtra (PlankAtomicPRef p)
 Not used for this class.
PlankUL pl_AtomicP_GetExtraUnchecked (PlankAtomicPRef p)
 Not used for this class.
static PlankP pl_AtomicP_Swap (PlankAtomicPRef p, PlankP newPtr)
 Swap the current pointer with a new pointer.
static void pl_AtomicP_SwapOther (PlankAtomicPRef p1, PlankAtomicPRef p2)
 Swap over two values.
static void pl_AtomicP_Set (PlankAtomicPRef p, PlankP newPtr)
 Set the current pointer to a new pointer.
static PlankP pl_AtomicP_Add (PlankAtomicPRef p, PlankL operand)
 Offset current pointer.
static PlankP pl_AtomicP_Subtract (PlankAtomicPRef p, PlankL operand)
 Offset current pointer in a negative direct.
static PlankP pl_AtomicP_Increment (PlankAtomicPRef p)
 Increment the current pointer by 1 byte.
static PlankP pl_AtomicP_Decrement (PlankAtomicPRef p)
 Decrement the current pointer by 1 byte.
static PlankB pl_AtomicP_CompareAndSwap (PlankAtomicPRef p, PlankP oldPtr, PlankP newPtr)
 Swap the current pointer with a new pointer if a specified old pointer is still current.

Detailed Description

Atomic pointer.

This will be the natural width of the pointer on the runtime platform.

Use AtomicPX for safer pointer storage.


Typedef Documentation

typedef struct PlankAtomicP* PlankAtomicPRef

An opaque reference to the Plank AtomicP object (atomic pointer).


Function Documentation

static PlankP pl_AtomicP_Add ( PlankAtomicPRef  p,
PlankL  operand 
) [static]

Offset current pointer.

Parameters:
pThe Plank AtomicP object.
operandThe number of bytes by which to offset.
Returns:
The new pointer.
static PlankB pl_AtomicP_CompareAndSwap ( PlankAtomicPRef  p,
PlankP  oldPtr,
PlankP  newPtr 
) [static]

Swap the current pointer with a new pointer if a specified old pointer is still current.

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 pointer again and retrying to write the new pointer (e.g., in a loop) until successful. If there are no other threads contending to write the pointer the operation should succeed without blocking.

Parameters:
pThe Plank AtomicP object.
oldPtrThe expected old pointer being currently stored.
newPtrThe new pointer to attempt to store.
Returns:
true if the swap was successful, otherwise false.
PlankAtomicPRef pl_AtomicP_Create ( )

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

Returns:
A Plank AtomicD object as an opaque reference or PLANK_NULL.
PlankAtomicPRef pl_AtomicP_CreateAndInit ( )

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

Returns:
A Plank AtomicP object as an opaque reference or PLANK_NULL.
static PlankP pl_AtomicP_Decrement ( PlankAtomicPRef  p) [static]

Decrement the current pointer by 1 byte.

Parameters:
pThe Plank AtomicP object.
Returns:
The new pointer.
static PlankResult pl_AtomicP_DeInit ( PlankAtomicPRef  p) [inline, static]

Deinitialise a Plank AtomicP object.

Parameters:
pThe Plank AtomicP object.
Returns:
PlankResult_OK if successful, otherwise an error code.
PlankResult pl_AtomicP_Destroy ( PlankAtomicPRef  p)

Destroy a Plank AtomicP object.

Parameters:
pThe Plank AtomicP object.
Returns:
PlankResult_OK if successful, otherwise an error code.
static PlankP pl_AtomicP_Get ( PlankAtomicPRef  p) [static]

Get the current value.

Parameters:
pThe Plank AtomicP object.
Returns:
The value.
PlankUL pl_AtomicP_GetExtra ( PlankAtomicPRef  p)

Not used for this class.

Use AtomicPX for safer pointer storage.

Parameters:
pThe Plank AtomicI object.
Returns:
Always returns 0.
PlankUL pl_AtomicP_GetExtraUnchecked ( PlankAtomicPRef  p)

Not used for this class.

Use AtomicPX for safer pointer storage.

Parameters:
pThe Plank AtomicI object.
Returns:
Always returns 0.
static PlankP pl_AtomicP_GetUnchecked ( PlankAtomicPRef  p) [static]

Get the current value nonatomically.

Parameters:
pThe Plank AtomicP object.
Returns:
The value.
static PlankP pl_AtomicP_Increment ( PlankAtomicPRef  p) [static]

Increment the current pointer by 1 byte.

Parameters:
pThe Plank AtomicP object.
Returns:
The new pointer.
static PlankResult pl_AtomicP_Init ( PlankAtomicPRef  p) [inline, static]

Initialise a Plank AtomicP object.

Parameters:
pThe Plank AtomicP object.
Returns:
PlankResult_OK if successful, otherwise an error code.
static void pl_AtomicP_Set ( PlankAtomicPRef  p,
PlankP  newPtr 
) [static]

Set the current pointer to a new pointer.

Parameters:
pThe Plank AtomicP object.
newPtrThe new pointer to store.
static PlankP pl_AtomicP_Subtract ( PlankAtomicPRef  p,
PlankL  operand 
) [static]

Offset current pointer in a negative direct.

Parameters:
pThe Plank AtomicP object.
operandThe number of bytes to subtract from the pointer.
Returns:
The new pointer.
static PlankP pl_AtomicP_Swap ( PlankAtomicPRef  p,
PlankP  newPtr 
) [static]

Swap the current pointer with a new pointer.

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