diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-07-28 16:58:05 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-07-29 12:29:42 +0100 |
commit | 89906f3e3d79f074156e16a12b4030188fd7e368 (patch) | |
tree | 6d34bccb30ddd92d625bb22e6f447bc06311b4b7 /dbus/dbus-sysdeps.c | |
parent | 0614a49274b85384f798beb3440c875091224c5a (diff) | |
download | dbus-89906f3e3d79f074156e16a12b4030188fd7e368.tar.gz |
Implement _dbus_atomic_get directly, rather than via inc + dec
The Windows implementation is untested, but does at least (cross-)compile,
and matches what GLib does.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38005
Reviewed-by: Lennart Poettering <lennart@poettering.net>
Diffstat (limited to 'dbus/dbus-sysdeps.c')
-rw-r--r-- | dbus/dbus-sysdeps.c | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c index 18f69dc3..bab516de 100644 --- a/dbus/dbus-sysdeps.c +++ b/dbus/dbus-sysdeps.c @@ -1067,30 +1067,6 @@ _dbus_strerror_from_errno (void) return _dbus_strerror (errno); } -/** - * Atomically get the value of an integer. It may change at any time - * thereafter, so this is mostly only useful for assertions. - * - * This function temporarily increases the atomic integer, so only - * use it in contexts where that would be OK (such as refcounts). - * - * @param atomic pointer to the integer to increment - * @returns the value at this moment - */ -dbus_int32_t -_dbus_atomic_get (DBusAtomic *atomic) -{ - dbus_int32_t old_value; - - /* On Windows we use InterlockedIncrement and InterlockedDecrement, - * and there is no InterlockedGet, so we have to change the value. - * Increasing it is less likely to have bad side-effects (for instance, - * it's OK for refcounts). */ - old_value = _dbus_atomic_inc (atomic); - _dbus_atomic_dec (atomic); - return old_value; -} - /** @} end of sysdeps */ /* tests in dbus-sysdeps-util.c */ |