Atomic long long.
More...
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
An opaque reference to the Plank AtomicLL object (atomic 64-bit integer).
Function Documentation
Add a value to the current value.
- Parameters:
-
p | The Plank AtomicLL object. |
operand | The 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:
-
p | The Plank AtomicLL object. |
oldValue | The expected old value being currently stored. |
newValue | The new value to attempt to store. |
- Returns:
true
if the swap was successful, otherwise false
.
Create a Plank AtomicLL object and return an oqaque reference to it.
- Returns:
- A Plank AtomicLL object as an opaque reference or PLANK_NULL.
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.
Decrement the current value by 1.
- Parameters:
-
p | The Plank AtomicLL object. |
- Returns:
- The new value.
Deinitialise a Plank AtomicLL object.
- Parameters:
-
p | The Plank AtomicLL object. |
- Returns:
- PlankResult_OK if successful, otherwise an error code.
Destroy a Plank AtomicLL object.
- Parameters:
-
p | The Plank AtomicLL object. |
- Returns:
- PlankResult_OK if successful, otherwise an error code.
Get the current value.
- Parameters:
-
p | The Plank AtomicLL object. |
- Returns:
- The value.
Not used for this class.
- Parameters:
-
p | The Plank AtomicLL object. |
- Returns:
- Always returns 0.
Not used for this class.
- Parameters:
-
p | The Plank AtomicLL object. |
- Returns:
- Always returns 0.
Get the current value nonatomically.
- Parameters:
-
p | The Plank AtomicLL object. |
- Returns:
- The value.
Increment the current value by 1.
- Parameters:
-
p | The Plank AtomicLL object. |
- Returns:
- The new value.
Initialise a Plank AtomicLL object.
- Parameters:
-
p | The Plank AtomicLL object. |
- Returns:
- PlankResult_OK if successful, otherwise an error code.
Set the current value to a new value.
- Parameters:
-
p | The Plank AtomicLL object. |
newValue | The new value to store. |
static PlankLL pl_AtomicLL_Subtract |
( |
PlankAtomicLLRef |
p, |
|
|
PlankLL |
operand |
|
) |
| [static] |
Subtract a value from the current value.
- Parameters:
-
p | The Plank AtomicLL object. |
operand | The 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:
-
p | The Plank AtomicLL object. |
newValue | The new value to store. |
- Returns:
- The previously stored value.
Swap over two values.
The contents of p1 is copied to p2 and p2 is copied to p1 in an atomic operation.
- Parameters:
-
p1 | One Plank AtomicLL object. |
p2 | The other Plank AtomicLL object. |