diff options
Diffstat (limited to 'dbus/dbus-sysdeps-unix.c')
-rw-r--r-- | dbus/dbus-sysdeps-unix.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 9b6457b2..26fa5f94 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -1428,6 +1428,24 @@ _dbus_getuid (void) return getuid (); } +_DBUS_DEFINE_GLOBAL_LOCK (atomic); + +#ifdef DBUS_USE_ATOMIC_INT_486 +/* Taken from CVS version 1.7 of glibc's sysdeps/i386/i486/atomicity.h */ +/* Since the asm stuff here is gcc-specific we go ahead and use "inline" also */ +static inline dbus_int32_t +atomic_exchange_and_add (DBusAtomic *atomic, + volatile dbus_int32_t val) +{ + register dbus_int32_t result; + + __asm__ __volatile__ ("lock; xaddl %0,%1" + : "=r" (result), "=m" (atomic->value) + : "0" (val), "m" (atomic->value)); + return result; +} +#endif + /** * Atomically increments an integer * |