#include "config.h"
#include "atomic.h"
Go to the source code of this file.
int avpriv_atomic_int_get |
( |
volatile int * |
ptr | ) |
|
Load the current value stored in an atomic integer.
- Parameters
-
- Returns
- the current value of the atomic integer
- Note
- This acts as a memory barrier.
Definition at line 75 of file atomic.c.
Referenced by main().
void avpriv_atomic_int_set |
( |
volatile int * |
ptr, |
|
|
int |
val |
|
) |
| |
Store a new value in an atomic integer.
- Parameters
-
ptr | atomic integer |
val | the value to store in the atomic integer |
- Note
- This acts as a memory barrier.
Definition at line 80 of file atomic.c.
Referenced by main().
int avpriv_atomic_int_add_and_fetch |
( |
volatile int * |
ptr, |
|
|
int |
inc |
|
) |
| |
Add a value to an atomic integer.
- Parameters
-
ptr | atomic integer |
inc | the value to add to the atomic integer (may be negative) |
- Returns
- the new value of the atomic integer.
- Note
- This does NOT act as a memory barrier. This is primarily intended for reference counting.
Definition at line 85 of file atomic.c.
Referenced by main().
void* avpriv_atomic_ptr_cas |
( |
void *volatile * |
ptr, |
|
|
void * |
oldval, |
|
|
void * |
newval |
|
) |
| |
Atomic pointer compare and swap.
- Parameters
-
ptr | pointer to the pointer to operate on |
oldval | do the swap if the current value of *ptr equals to oldval |
newval | value to replace *ptr with |
- Returns
- the value of *ptr before comparison
Definition at line 91 of file atomic.c.