FreeSWITCH API Documentation  1.7.0
Typedefs | Functions
Multi-Threaded Adtomic Operations Routines
+ Collaboration diagram for Multi-Threaded Adtomic Operations Routines:

Typedefs

typedef uint32_t switch_atomic_t
 

Functions

switch_status_t switch_atomic_init (switch_memory_pool_t *pool)
 
uint32_t switch_atomic_read (volatile switch_atomic_t *mem)
 
void switch_atomic_set (volatile switch_atomic_t *mem, uint32_t val)
 
void switch_atomic_add (volatile switch_atomic_t *mem, uint32_t val)
 
void switch_atomic_inc (volatile switch_atomic_t *mem)
 
int switch_atomic_dec (volatile switch_atomic_t *mem)
 

Detailed Description

Typedef Documentation

typedef uint32_t switch_atomic_t

Opaque type used for the atomic operations

Definition at line 380 of file switch_apr.h.

Function Documentation

void switch_atomic_add ( volatile switch_atomic_t mem,
uint32_t  val 
)

Uses an atomic operation to add the uint32 value to the value at the specified location of memory.

Parameters
memThe location of the value to add to.
valThe uint32 value to add to the value at the memory location.

Definition at line 1289 of file switch_apr.c.

1290 {
1291 #ifdef apr_atomic_t
1292  apr_atomic_add((apr_atomic_t *)mem, val);
1293 #else
1294  apr_atomic_add32((apr_uint32_t *)mem, val);
1295 #endif
1296 }
int switch_atomic_dec ( volatile switch_atomic_t mem)

Uses an atomic operation to decrement the value at the specified memroy location.

Parameters
memThe location of the value to decrement.

Definition at line 1307 of file switch_apr.c.

1308 {
1309 #ifdef apr_atomic_t
1310  return apr_atomic_dec((apr_atomic_t *)mem);
1311 #else
1312  return apr_atomic_dec32((apr_uint32_t *)mem);
1313 #endif
1314 }
void switch_atomic_inc ( volatile switch_atomic_t mem)

Uses an atomic operation to increment the value at the specified memroy location.

Parameters
memThe location of the value to increment.

Definition at line 1298 of file switch_apr.c.

1299 {
1300 #ifdef apr_atomic_t
1301  apr_atomic_inc((apr_atomic_t *)mem);
1302 #else
1303  apr_atomic_inc32((apr_uint32_t *)mem);
1304 #endif
1305 }
switch_status_t switch_atomic_init ( switch_memory_pool_t pool)

Some architectures require atomic operations internal structures to be initialized before use.

Parameters
poolThe memory pool to use when initializing the structures.

Definition at line 1266 of file switch_apr.c.

1267 {
1268  return apr_atomic_init((apr_pool_t *) pool);
1269 }
switch_memory_pool_t * pool
uint32_t switch_atomic_read ( volatile switch_atomic_t mem)

Uses an atomic operation to read the uint32 value at the location specified by mem.

Parameters
memThe location of memory which stores the value to read.

Definition at line 1271 of file switch_apr.c.

Referenced by switch_xml_config_parse_event().

1272 {
1273 #ifdef apr_atomic_t
1274  return apr_atomic_read((apr_atomic_t *)mem);
1275 #else
1276  return apr_atomic_read32((apr_uint32_t *)mem);
1277 #endif
1278 }
void switch_atomic_set ( volatile switch_atomic_t mem,
uint32_t  val 
)

Uses an atomic operation to set a uint32 value at a specified location of memory.

Parameters
memThe location of memory to set.
valThe uint32 value to set at the memory location.

Definition at line 1280 of file switch_apr.c.

Referenced by switch_xml_config_parse_event().

1281 {
1282 #ifdef apr_atomic_t
1283  apr_atomic_set((apr_atomic_t *)mem, val);
1284 #else
1285  apr_atomic_set32((apr_uint32_t *)mem, val);
1286 #endif
1287 }