Zen API

- Home
- Help Topics
- Types by Category
- All Types
- Files

All Classes Files Functions Variables Typedefs Macros Groups Pages
Public Member Functions
kAtomic Class Reference
kApi/Threads

## Description

Collection of functions for atomic variable operations.

## Public Member Functions
kBool | kAtomic_CompareExchange32s (volatile k32s *atomic, k32s oldValue, k32s value)
| Conditionally exchanges the value of an atomic variable. More...
kBool | kAtomic_CompareExchangePointer (volatile kPointer *atomic, kPointer oldValue, kPointer value)
| Conditionally exchanges the value of an atomic variable. More...
k32s | kAtomic_Decrement32s (volatile k32s *atomic)
| Decrements an atomic variable. More...
k32s | kAtomic_Exchange32s (volatile k32s *atomic, k32s value)
| Exchanges the value of an atomic variable. More...
kPointer | kAtomic_ExchangePointer (volatile kPointer *atomic, kPointer value)
| Exchanges the value of an atomic variable. More...
k32s | kAtomic_Get32s (volatile k32s *atomic)
| Gets the current value of an atomic variable. More...
k32s | kAtomic_Increment32s (volatile k32s *atomic)
| Increments an atomic variable. More...

## Member Function Documentation

kBool kAtomic_CompareExchange32s | ( | volatile k32s * | atomic,
|  | k32s | oldValue,
|  | k32s | value
| ) |  |

Conditionally exchanges the value of an atomic variable.

If the atomic value is equal to the oldValue argument, then it is replaced by the value argument.

This method is thread-safe. Implements a full memory barrier.

Parameters

  atomic | Pointer to atomic variable.
  oldValue | Previous atomic value.
  value | New atomic value.

Returns
  kTRUE if the exchange succeeded.

kBool kAtomic_CompareExchangePointer | ( | volatile kPointer * | atomic,
|  | kPointer | oldValue,
|  | kPointer | value
| ) |  |

Conditionally exchanges the value of an atomic variable.

If the atomic value is equal to the oldValue argument, then it is replaced by the value argument.

This method is thread-safe. Implements a full memory barrier.

Parameters

  atomic | Pointer to atomic variable.
  oldValue | Previous atomic value.
  value | New atomic value.

Returns
  Previous atomic value.

k32s kAtomic_Decrement32s | ( | volatile k32s * | atomic | ) |

Decrements an atomic variable.

This method is thread-safe. Implements a full memory barrier.

Parameters

  atomic | Pointer to atomic variable.

Returns
  New atomic value.

k32s kAtomic_Exchange32s | ( | volatile k32s * | atomic,
|  | k32s | value
| ) |  |

Exchanges the value of an atomic variable.

This method is thread-safe. Implements a full memory barrier.

Parameters

  atomic | Pointer to atomic variable.
  value | New atomic value.

Returns
  Previous atomic value.

kPointer kAtomic_ExchangePointer | ( | volatile kPointer * | atomic,
|  | kPointer | value
| ) |  |

Exchanges the value of an atomic variable.

This method is thread-safe. Implements a full memory barrier.

Parameters

  atomic | Pointer to atomic variable.
  value | New atomic value.

Returns
  Previous atomic value.

k32s kAtomic_Get32s | ( | volatile k32s * | atomic | ) |

Gets the current value of an atomic variable.

This method is thread-safe. Implements a full memory barrier.

Parameters

  atomic | Pointer to atomic variable.

Returns
  Atomic value.

k32s kAtomic_Increment32s | ( | volatile k32s * | atomic | ) |

Increments an atomic variable.

This method is thread-safe. Implements a full memory barrier.

Parameters

  atomic | Pointer to atomic variable.

Returns
  New atomic value.

The documentation for this class was generated from the following file:

- Threads/kAtomic.h