![]() | ![]() | ![]() | GStreamer 0.8 Core Reference Manual | ![]() |
---|
GstAtomic — Functions that implement atomic operations.
#include <gst/gst.h> typedef gst_vgint; struct GstAtomicInt; void gst_atomic_int_init (GstAtomicInt *aint, gint val); void gst_atomic_int_destroy (GstAtomicInt *aint); void gst_atomic_int_set (GstAtomicInt *aint, gint val); gint gst_atomic_int_read (GstAtomicInt *aint); void gst_atomic_int_add (GstAtomicInt *aint, gint val); void gst_atomic_int_inc (GstAtomicInt *aint); gboolean gst_atomic_int_dec_and_test (GstAtomicInt *aint);
Functions that implement atomic operations on a GstAtomicInt structure. Atomic operations are thread safe and don't use heavyweight locking mechanisms.
These functions will be inlined in the GStreamer core but are available to plugins as external methods.
struct GstAtomicInt { gst_vgint counter; GMutex *lock; /* for C fallback */ };
A structure that contains an integer that can be modified atomically.
void gst_atomic_int_init (GstAtomicInt *aint, gint val);
Initialize an allocated GstAtomicInt with a value. Call this method only once as it will allocate a mutex in the C-fallback case.
aint : | a GstAtomicInt |
val : | a new value |
void gst_atomic_int_destroy (GstAtomicInt *aint);
Destroy a GstAtomicInt. Call this method only once as it will free the mutex in the C-fallback case.
aint : | a GstAtomicInt |
void gst_atomic_int_set (GstAtomicInt *aint, gint val);
Atomically set the value on the GstAtomicInt.
aint : | a GstAtomicInt |
val : | The new value |
gint gst_atomic_int_read (GstAtomicInt *aint);
Atomically read the contents of a GstAtomicInt
aint : | a GstAtomicInt |
Returns : | the value of the atomic int |
void gst_atomic_int_add (GstAtomicInt *aint, gint val);
Atomically add the given value to the GstAtomicInt.
aint : | a GstAtomicInt |
val : | the value to add |
void gst_atomic_int_inc (GstAtomicInt *aint);
Atomically increment the GstAtomicInt
aint : | a GstAtomicInt |
gboolean gst_atomic_int_dec_and_test (GstAtomicInt *aint);
Atomically decrement the GstAtomicInt and test if it is zero.
aint : | a GstAtomicInt |
Returns : | TRUE if the atomic int is 0 |
<< GStreamer Core Support | GstMacros >> |