Software: Apache/2.0.54 (Fedora). PHP/5.0.4 uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 uid=48(apache) gid=48(apache) groups=48(apache) Safe-mode: OFF (not secure) /usr/share/gtk-doc/html/glib/ drwxr-xr-x |
Viewing file: Select action/file-type:
Synopsis#include <glib.h> gint g_atomic_int_get (gint *atomic); void g_atomic_int_add (gint *atomic, gint val); gint g_atomic_int_exchange_and_add (gint *atomic, gint val); gboolean g_atomic_int_compare_and_exchange (gint *atomic, gint oldval, gint newval); gpointer g_atomic_pointer_get (gpointer *atomic); gboolean g_atomic_pointer_compare_and_exchange (gpointer *atomic, gpointer oldval, gpointer newval); void g_atomic_int_inc (gint *atomic); gboolean g_atomic_int_dec_and_test (gint *atomic); DescriptionThe following functions can be used to atomically access integers and pointers. They are implemented as inline assembler function on most platforms and use slower fall-backs otherwise. Using them can sometimes save you from using a performance-expensive GMutex to protect the integer or pointer.
The most important usage is reference counting. Using
Note
You must not directly read integers or pointers concurrently accessed
by other threads with with the following functions directly. Always use
Note
If you are using those functions for anything apart from simple
reference counting, you should really be aware of the implications of
doing that. There are literally thousands of ways to shoot yourself in
the foot. So if in doubt, use a GMutex. If you don't know, what
memory barriers are, do not use anything but Note
It is not safe to set an integer or pointer just by assigning to it,
when it is concurrently accessed by other threads with the following
functions. Use Detailsg_atomic_int_get ()gint g_atomic_int_get (gint *atomic);
Reads the value of the integer pointed to by
Since 2.4 g_atomic_int_add ()void g_atomic_int_add (gint *atomic, gint val);
Atomically adds
Since 2.4 g_atomic_int_exchange_and_add ()gint g_atomic_int_exchange_and_add (gint *atomic, gint val);
Atomically adds
Since 2.4 g_atomic_int_compare_and_exchange ()gboolean g_atomic_int_compare_and_exchange (gint *atomic, gint oldval, gint newval);
Compares
Since 2.4 g_atomic_pointer_get ()gpointer g_atomic_pointer_get (gpointer *atomic);
Reads the value of the pointer pointed to by
Since 2.4 g_atomic_pointer_compare_and_exchange ()gboolean g_atomic_pointer_compare_and_exchange (gpointer *atomic, gpointer oldval, gpointer newval);
Compares
Since 2.4 g_atomic_int_inc ()void g_atomic_int_inc (gint *atomic);
Atomically increments the integer pointed to by
Since 2.4
|
:: Command execute :: | |
--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0033 ]-- |