upipe/uatomic.h header reference

Upipe thread-safe atomic operations More

Header inclusion  

Members  

Type  

Functions  

Description  

This API mimicks a partial C11 stdatomic implementation. Atomic variables must be initialized with uatomic_init before use, and released with uatomic_clean before deallocation.

Members detail  

#define _UPIPE_UATOMIC_H_  

This macro is declared in upipe/uatomic.h source file, line 34.

void uatomic_clean(uatomic_uint32_t *obj)  

This function is declared in upipe/uatomic.h source file, line 139.

This function cleans up the uatomic variable.

Parameters list:

  • obj: pointer to a uatomic variable

bool uatomic_compare_exchange(uatomic_uint32_t *obj, uint32_t *expected, uint32_t desired)  

This function is declared in upipe/uatomic.h source file, line 102.

This function atomically replaces the uatomic variable, if it contains an expected value, with a desired value.

Parameters list:

  • obj: pointer to a uatomic variable
  • expected: reference to expected value, overwritten with actual value if it fails
  • desired: desired value

The return value is false if the exchange failed

uint32_t uatomic_fetch_add(uatomic_uint32_t *obj, uint32_t operand)  

This function is declared in upipe/uatomic.h source file, line 118.

This function increments a uatomic variable.

Parameters list:

  • obj: pointer to a uatomic variable
  • operand: value to add

The return value is value before the operation

uint32_t uatomic_fetch_sub(uatomic_uint32_t *obj, uint32_t operand)  

This function is declared in upipe/uatomic.h source file, line 130.

This function decrements a uatomic variable.

Parameters list:

  • obj: pointer to a uatomic variable
  • operand: value to substract

The return value is value before the operation

void uatomic_init(uatomic_uint32_t *obj, uint32_t value)  

This function is declared in upipe/uatomic.h source file, line 63.

This function initializes a uatomic variable. It must be executed before any other uatomic call. It is not thread-safe.

Parameters list:

  • obj: pointer to a uatomic variable
  • value: initial value

uint32_t uatomic_load(uatomic_uint32_t *obj)  

This function is declared in upipe/uatomic.h source file, line 85.

This function returns the value of the uatomic variable.

Parameters list:

  • obj: pointer to a uatomic variable

The return value is value

void uatomic_store(uatomic_uint32_t *obj, uint32_t value)  

This function is declared in upipe/uatomic.h source file, line 74.

This function sets the value of the uatomic variable.

Parameters list:

  • obj: pointer to a uatomic variable
  • value: value to set

typedef uint32_t uatomic_uint32_t  

This typedef is declared in upipe/uatomic.h source file, line 54.

This typedef defines an atomic 32-bits unsigned integer. ARM platforms do not support larger atomic operations.

See also uring_lifo typedef and uring_fifo typedef.

Valid XHTML 1.0 StrictGenerated by cmassiot on Thu Nov 6 12:15:31 2014 using MkDoc