atomic.h File Reference

Atomic functions. More...

#include <stdint.h>
Include dependency graph for atomic.h:

Functions

const char * cmx_atomic_implementation_name ()
 current implementation
Get/Set operations

Get and set on volatile casted pointers.



uint16_t cmx_atomic_read_uint16 (volatile const uint16_t *ptr)
 Reads the value of type uint16_t at 'ptr'.
void cmx_atomic_set_uint16 (volatile uint16_t *ptr, uint16_t val)
 Sets memory of type uint16_t at 'ptr' to value 'val'.
int32_t cmx_atomic_read_int32 (volatile const int32_t *ptr)
 Reads the value of type int32_t at 'ptr'.
void cmx_atomic_set_int32 (volatile int32_t *ptr, int32_t val)
 Sets memory of type int32_t at 'ptr' to value 'val'.
uint64_t cmx_atomic_read_uint64 (volatile const uint64_t *ptr)
 Reads the value of type uint16_t at 'ptr'.
void cmx_atomic_set_uint64 (volatile uint64_t *ptr, uint64_t val)
 Sets memory of type uint16_t at 'ptr' to value 'val'.
Atomic operations

Functions wrapping atomic operations.



int32_t cmx_atomic_val_compare_and_swap_int32 (volatile int32_t *ptr, int32_t oldval, int32_t newval)
 CAS for a int32_t value.
Memory barriers.

Functions to generate memory barriers.



void cmx_atomic_smp_mb ()
 Insert a full memory barrier.
void cmx_atomic_smp_rmb ()
 Insert a read memory barrier.
void cmx_atomic_smp_wmb ()
 Insert a write memory barrier.

Detailed Description

Atomic functions.

For reference see:


Function Documentation

const char* cmx_atomic_implementation_name (  ) 

current implementation

Name of the implementation selected at compile-time.

Note:
This function may return empty string if gcc-builtin is used for all targets in future.
Returns:
the name of the atomic implementation
int32_t cmx_atomic_read_int32 ( volatile const int32_t *  ptr  ) 

Reads the value of type int32_t at 'ptr'.

No memory barrier is generated by this function.

Returns:
The value read at 'ptr'.
uint16_t cmx_atomic_read_uint16 ( volatile const uint16_t *  ptr  ) 

Reads the value of type uint16_t at 'ptr'.

See also:
cmx_atomic_read_int32()
uint64_t cmx_atomic_read_uint64 ( volatile const uint64_t *  ptr  ) 

Reads the value of type uint16_t at 'ptr'.

See also:
cmx_atomic_read_int32()
void cmx_atomic_set_int32 ( volatile int32_t *  ptr,
int32_t  val 
)

Sets memory of type int32_t at 'ptr' to value 'val'.

No memory barrier generated by this function.

void cmx_atomic_set_uint16 ( volatile uint16_t *  ptr,
uint16_t  val 
)

Sets memory of type uint16_t at 'ptr' to value 'val'.

See also:
cmx_atomic_set_int32()
void cmx_atomic_set_uint64 ( volatile uint64_t *  ptr,
uint64_t  val 
)

Sets memory of type uint16_t at 'ptr' to value 'val'.

See also:
cmx_atomic_set_int32()
int32_t cmx_atomic_val_compare_and_swap_int32 ( volatile int32_t *  ptr,
int32_t  oldval,
int32_t  newval 
)

CAS for a int32_t value.

Compare a int32_t value pointed to by 'ptr' with 'oldval'. If they are the same, swap the value with 'newval'. returns always the value pointed to by 'ptr' before the operation.

A successful operation is: compare_and_swap(&val, oldval, newval) == oldval

Parameters:
ptr pointer to the value
oldval what to swap it with
newval the value to compare it to
Returns:
the old value of *ptr

Here is the caller graph for this function:


Generated on 14 Feb 2014 by  doxygen 1.6.1