This module provides API to manipulate atomic variables.
Examples
For some example codes, please see:
◆ pj_atomic_add()
Add a value to an atomic type.
- Parameters
-
atomic_var | The atomic variable. |
value | Value to be added. |
◆ pj_atomic_add_and_get()
Add a value to an atomic type and get the result.
- Parameters
-
atomic_var | The atomic variable. |
value | Value to be added. |
- Returns
- The result after the addition.
◆ pj_atomic_create()
Create atomic variable.
- Parameters
-
pool | The pool. |
initial | The initial value of the atomic variable. |
atomic | Pointer to hold the atomic variable upon return. |
- Returns
- PJ_SUCCESS on success, or the error code.
◆ pj_atomic_dec()
Decrement the value of an atomic type.
- Parameters
-
atomic_var | the atomic variable. |
◆ pj_atomic_dec_and_get()
Decrement the value of an atomic type and get the result.
- Parameters
-
atomic_var | the atomic variable. |
- Returns
- The decremented value.
◆ pj_atomic_destroy()
Destroy atomic variable.
- Parameters
-
atomic_var | the atomic variable. |
- Returns
- PJ_SUCCESS if success.
◆ pj_atomic_get()
Get the value of an atomic type.
- Parameters
-
atomic_var | the atomic variable. |
- Returns
- the value of the atomic variable.
◆ pj_atomic_inc()
Increment the value of an atomic type.
- Parameters
-
atomic_var | the atomic variable. |
◆ pj_atomic_inc_and_get()
Increment the value of an atomic type and get the result.
- Parameters
-
atomic_var | the atomic variable. |
- Returns
- The incremented value.
◆ pj_atomic_set()
Set the value of an atomic type, and return the previous value.
- Parameters
-
atomic_var | the atomic variable. |
value | value to be set to the variable. |