Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

Atomic Operations
[Apache Portability Runtime library]


Functions

apr_status_t apr_atomic_init (apr_pool_t *p)
apr_uint32_t apr_atomic_read (volatile apr_atomic_t *mem)
void apr_atomic_set (volatile apr_atomic_t *mem, apr_uint32_t val)
void apr_atomic_add (volatile apr_atomic_t *mem, apr_uint32_t val)
void apr_atomic_inc (volatile apr_atomic_t *mem)
int apr_atomic_dec (volatile apr_atomic_t *mem)
apr_uint32_t apr_atomic_cas (volatile apr_uint32_t *mem, long with, long cmp)
void * apr_atomic_casptr (volatile void **mem, void *with, const void *cmp)

Variables

typedef apr_atomic_t

Function Documentation

void apr_atomic_add volatile apr_atomic_t   mem,
apr_uint32_t    val
 

Add 'val' to the atomic variable

Parameters:
mem  pointer to the atomic value
val  the addition

apr_uint32_t apr_atomic_cas volatile apr_uint32_t *    mem,
long    with,
long    cmp
 

compare the atomic's value with cmp. If they are the same swap the value with 'with'

Parameters:
mem  pointer to the atomic value
with  what to swap it with
cmp  the value to compare it to
Returns:
the old value of the atomic
Warning:
do not mix apr_atomic's with the CAS function. on some platforms they may be implemented by different mechanisms

void* apr_atomic_casptr volatile void **    mem,
void *    with,
const void *    cmp
 

compare the pointer's value with cmp. If they are the same swap the value with 'with'

Parameters:
mem  pointer to the pointer
with  what to swap it with
cmp  the value to compare it to
Returns:
the old value of the pointer

int apr_atomic_dec volatile apr_atomic_t   mem
 

decrement the atomic variable by 1

Parameters:
mem  pointer to the atomic value
Returns:
zero if the value is zero, otherwise non-zero

void apr_atomic_inc volatile apr_atomic_t   mem
 

increment the atomic variable by 1

Parameters:
mem  pointer to the atomic value

apr_status_t apr_atomic_init apr_pool_t   p
 

this function is required on some platforms to initialize the atomic operation's internal structures

Parameters:
p  pool
Returns:
APR_SUCCESS on successful completion

apr_uint32_t apr_atomic_read volatile apr_atomic_t   mem
 

read the value stored in a atomic variable

Parameters:
mem  the pointer
Warning:
on certain platforms this number is not stored directly in the pointer. in others it is

void apr_atomic_set volatile apr_atomic_t   mem,
apr_uint32_t    val
 

set the value for atomic.

Parameters:
mem  the pointer
val  the value


Variable Documentation

typedef apr_atomic_t
 

structure for holding a atomic value. this number >only< has a 24 bit size on some platforms


Generated on Thu Dec 25 11:41:05 2003 for Apache Portable Runtime by doxygen1.2.18