Commit d45c4a1f authored by Ralf Habacker's avatar Ralf Habacker

* dbus/dbus-sysdeps-unix.c: unix compile fix, moved

atomic_exchange_and_add() from dbus/dbus-sysdeps.c
to here, it's used by _dbus_atomic_inc() and _dbus_atomic_dec().
parent 3a33c8e2
2006-12-31 Ralf Habacker <ralf.habacker@freenet.de>
* dbus/dbus-sysdeps-unix.c: unix compile fix, moved
atomic_exchange_and_add() from dbus/dbus-sysdeps.c
to here, it's used by _dbus_atomic_inc() and _dbus_atomic_dec().
2006-12-31 Ralf Habacker <ralf.habacker@freenet.de>
* tools/dbus-monitor.c: gettimeofday() is not available
......
......@@ -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
*
......
......@@ -644,24 +644,6 @@ _dbus_credentials_match (const DBusCredentials *expected_credentials,
return FALSE;
}
_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
void
_dbus_generate_pseudorandom_bytes_buffer (char *buffer,
int n_bytes)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment