WARNING: The online documentation has moved to https://docs.pjsip.org.

Visit the new documentation at https://docs.pjsip.org:

BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJLIB Reference

Functions

pj_status_t pj_atomic_create (pj_pool_t *pool, pj_atomic_value_t initial, pj_atomic_t **atomic)
 
pj_status_t pj_atomic_destroy (pj_atomic_t *atomic_var)
 
void pj_atomic_set (pj_atomic_t *atomic_var, pj_atomic_value_t value)
 
pj_atomic_value_t pj_atomic_get (pj_atomic_t *atomic_var)
 
void pj_atomic_inc (pj_atomic_t *atomic_var)
 
pj_atomic_value_t pj_atomic_inc_and_get (pj_atomic_t *atomic_var)
 
void pj_atomic_dec (pj_atomic_t *atomic_var)
 
pj_atomic_value_t pj_atomic_dec_and_get (pj_atomic_t *atomic_var)
 
void pj_atomic_add (pj_atomic_t *atomic_var, pj_atomic_value_t value)
 
pj_atomic_value_t pj_atomic_add_and_get (pj_atomic_t *atomic_var, pj_atomic_value_t value)
 

Detailed Description

This module provides API to manipulate atomic variables.

Examples

For some example codes, please see:

Function Documentation

◆ pj_atomic_add()

void pj_atomic_add ( pj_atomic_t atomic_var,
pj_atomic_value_t  value 
)

Add a value to an atomic type.

Parameters
atomic_varThe atomic variable.
valueValue to be added.

◆ pj_atomic_add_and_get()

pj_atomic_value_t pj_atomic_add_and_get ( pj_atomic_t atomic_var,
pj_atomic_value_t  value 
)

Add a value to an atomic type and get the result.

Parameters
atomic_varThe atomic variable.
valueValue to be added.
Returns
The result after the addition.

◆ pj_atomic_create()

pj_status_t pj_atomic_create ( pj_pool_t pool,
pj_atomic_value_t  initial,
pj_atomic_t **  atomic 
)

Create atomic variable.

Parameters
poolThe pool.
initialThe initial value of the atomic variable.
atomicPointer to hold the atomic variable upon return.
Returns
PJ_SUCCESS on success, or the error code.

◆ pj_atomic_dec()

void pj_atomic_dec ( pj_atomic_t atomic_var)

Decrement the value of an atomic type.

Parameters
atomic_varthe atomic variable.

◆ pj_atomic_dec_and_get()

pj_atomic_value_t pj_atomic_dec_and_get ( pj_atomic_t atomic_var)

Decrement the value of an atomic type and get the result.

Parameters
atomic_varthe atomic variable.
Returns
The decremented value.

◆ pj_atomic_destroy()

pj_status_t pj_atomic_destroy ( pj_atomic_t atomic_var)

Destroy atomic variable.

Parameters
atomic_varthe atomic variable.
Returns
PJ_SUCCESS if success.

◆ pj_atomic_get()

pj_atomic_value_t pj_atomic_get ( pj_atomic_t atomic_var)

Get the value of an atomic type.

Parameters
atomic_varthe atomic variable.
Returns
the value of the atomic variable.

◆ pj_atomic_inc()

void pj_atomic_inc ( pj_atomic_t atomic_var)

Increment the value of an atomic type.

Parameters
atomic_varthe atomic variable.

◆ pj_atomic_inc_and_get()

pj_atomic_value_t pj_atomic_inc_and_get ( pj_atomic_t atomic_var)

Increment the value of an atomic type and get the result.

Parameters
atomic_varthe atomic variable.
Returns
The incremented value.

◆ pj_atomic_set()

void pj_atomic_set ( pj_atomic_t atomic_var,
pj_atomic_value_t  value 
)

Set the value of an atomic type, and return the previous value.

Parameters
atomic_varthe atomic variable.
valuevalue to be set to the variable.

 


PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.