summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-message.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-05-11 07:59:08 +0000
committerHavoc Pennington <hp@redhat.com>2003-05-11 07:59:08 +0000
commitab10ae902d8aa7c2b98fd080a7458127b1b8e648 (patch)
treeb566d610ee13aa1a4ab9013eb7d19eb3dd7ad1c8 /dbus/dbus-message.c
parent27b694f6e109c78c633ddb8d96f524e46e536f4e (diff)
2003-05-11 Havoc Pennington <hp@pobox.com>
Write a "test-profile" that does echo client-server with threads; profile reveals lock contention, memcpy/realloc of buffers, and UTF-8 validation as hot spots. 20% of lock contention eliminated with dbus_atomic_inc/dec implementation on x86. Much remaining contention is global mempool locks for GList and DBusList. * dbus/dbus-sysdeps.c (_dbus_atomic_inc, _dbus_atomic_dec): add x86 implementation * dbus/dbus-connection.c (struct DBusConnection): use dbus_atomic_t for the reference count * dbus/dbus-message.c (struct DBusMessage): declare dbus_atomic_t values as volatile * configure.in: code to detect ability to use atomic integer operations in assembly, from GLib patch * dbus/dbus-internals.c (_dbus_verbose_real): call getpid every time, tired of it being wrong in threads and forked processes * glib/test-profile.c: a little program to bounce messages back and forth between threads and eat CPU * dbus/dbus-connection.c: add debug spew macros for debugging thread locks; include config.h at top; fix deadlock in dbus_connection_flush()
Diffstat (limited to 'dbus/dbus-message.c')
-rw-r--r--dbus/dbus-message.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index 668736dc..29209106 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
@@ -81,7 +81,7 @@ typedef struct
*/
struct DBusMessage
{
- dbus_atomic_t refcount; /**< Reference count */
+ volatile dbus_atomic_t refcount; /**< Reference count */
DBusString header; /**< Header network data, stored
* separately from body so we can
@@ -1134,7 +1134,7 @@ dbus_message_copy (const DBusMessage *message)
void
dbus_message_ref (DBusMessage *message)
{
- dbus_atomic_t refcount;
+ volatile dbus_atomic_t refcount;
_dbus_return_if_fail (message != NULL);
@@ -1163,7 +1163,7 @@ free_size_counter (void *element,
void
dbus_message_unref (DBusMessage *message)
{
- dbus_atomic_t refcount;
+ volatile dbus_atomic_t refcount;
_dbus_return_if_fail (message != NULL);