dbus/dbus dbus-sysdeps-unix.c, 1.16, 1.17 dbus-sysdeps.c, 1.118,
1.119 dbus-sysdeps.h, 1.67, 1.68
Ralf Habacker
rhabacker at kemper.freedesktop.org
Sun Dec 31 04:16:06 PST 2006
Update of /cvs/dbus/dbus/dbus
In directory kemper:/tmp/cvs-serv15076/dbus
Modified Files:
dbus-sysdeps-unix.c dbus-sysdeps.c dbus-sysdeps.h
Log Message:
* dbus/dbus-sysdeps-unix.c: moved _dbus_atomic_inc/dec()
from dbus/dbus-sysdeps.c, windows version of _dbus_atomic_inc/dec()
is in dbus-sysdeps-win.c (not in this patch).
* dbus/dbus-sysdeps.h: DBusAtomic::value is long on windows to fit
with InterlockedInc/Decrement. - Patches from Christian Ehrlicher
Index: dbus-sysdeps-unix.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps-unix.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- dbus-sysdeps-unix.c 1 Nov 2006 23:30:46 -0000 1.16
+++ dbus-sysdeps-unix.c 31 Dec 2006 12:16:04 -0000 1.17
@@ -1428,6 +1428,53 @@
return getuid ();
}
+/**
+ * Atomically increments an integer
+ *
+ * @param atomic pointer to the integer to increment
+ * @returns the value before incrementing
+ *
+ * @todo implement arch-specific faster atomic ops
+ */
+dbus_int32_t
+_dbus_atomic_inc (DBusAtomic *atomic)
+{
+#ifdef DBUS_USE_ATOMIC_INT_486
+ return atomic_exchange_and_add (atomic, 1);
+#else
+ dbus_int32_t res;
+ _DBUS_LOCK (atomic);
+ res = atomic->value;
+ atomic->value += 1;
+ _DBUS_UNLOCK (atomic);
+ return res;
+#endif
+}
+
+/**
+ * Atomically decrement an integer
+ *
+ * @param atomic pointer to the integer to decrement
+ * @returns the value before decrementing
+ *
+ * @todo implement arch-specific faster atomic ops
+ */
+dbus_int32_t
+_dbus_atomic_dec (DBusAtomic *atomic)
+{
+#ifdef DBUS_USE_ATOMIC_INT_486
+ return atomic_exchange_and_add (atomic, -1);
+#else
+ dbus_int32_t res;
+
+ _DBUS_LOCK (atomic);
+ res = atomic->value;
+ atomic->value -= 1;
+ _DBUS_UNLOCK (atomic);
+ return res;
+#endif
+}
+
#ifdef DBUS_BUILD_TESTS
/** Gets our GID
* @returns process GID
Index: dbus-sysdeps.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- dbus-sysdeps.c 21 Oct 2006 18:17:02 -0000 1.118
+++ dbus-sysdeps.c 31 Dec 2006 12:16:04 -0000 1.119
@@ -662,53 +662,6 @@
}
#endif
-/**
- * Atomically increments an integer
- *
- * @param atomic pointer to the integer to increment
- * @returns the value before incrementing
- *
- * @todo implement arch-specific faster atomic ops
- */
-dbus_int32_t
-_dbus_atomic_inc (DBusAtomic *atomic)
-{
-#ifdef DBUS_USE_ATOMIC_INT_486
- return atomic_exchange_and_add (atomic, 1);
-#else
- dbus_int32_t res;
- _DBUS_LOCK (atomic);
- res = atomic->value;
- atomic->value += 1;
- _DBUS_UNLOCK (atomic);
- return res;
-#endif
-}
-
-/**
- * Atomically decrement an integer
- *
- * @param atomic pointer to the integer to decrement
- * @returns the value before decrementing
- *
- * @todo implement arch-specific faster atomic ops
- */
-dbus_int32_t
-_dbus_atomic_dec (DBusAtomic *atomic)
-{
-#ifdef DBUS_USE_ATOMIC_INT_486
- return atomic_exchange_and_add (atomic, -1);
-#else
- dbus_int32_t res;
-
- _DBUS_LOCK (atomic);
- res = atomic->value;
- atomic->value -= 1;
- _DBUS_UNLOCK (atomic);
- return res;
-#endif
-}
-
void
_dbus_generate_pseudorandom_bytes_buffer (char *buffer,
int n_bytes)
Index: dbus-sysdeps.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.h,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- dbus-sysdeps.h 2 Nov 2006 04:26:23 -0000 1.67
+++ dbus-sysdeps.h 31 Dec 2006 12:16:04 -0000 1.68
@@ -229,7 +229,11 @@
*/
struct DBusAtomic
{
+#ifdef DBUS_WIN
+ volatile long value; /**< Value of the atomic integer. */
+#else
volatile dbus_int32_t value; /**< Value of the atomic integer. */
+#endif
};
dbus_int32_t _dbus_atomic_inc (DBusAtomic *atomic);
More information about the dbus-commit
mailing list