summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-bus.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-03-24 03:16:58 +0000
committerHavoc Pennington <hp@redhat.com>2003-03-24 03:16:58 +0000
commitc3af5ccdbc22e8990d04ec2f89ad1f2e053655e9 (patch)
tree6010b0b9a2be255b3ff3ac9f62e4c04ce57aef83 /dbus/dbus-bus.c
parenta26607ab68bf0878f23d2dbddec781b4b760d034 (diff)
2003-03-23 Havoc Pennington <hp@pobox.com>
* dbus/dbus-threads.c (dbus_mutex_new, dbus_condvar_new): with DBUS_BUILD_TESTS, actually alloc/free a block of memory for the mutex, so we can check for proper memory management and OOM handling. * dbus/dbus-dataslot.c: remove the mutex from DBusDataSlotAllocator and lock it manually when using it, to simplify fitting it into the global slots framework. * dbus/dbus-threads.c (init_static_locks): rework how we're handling global locks so they are easily shut down. * bus/policy.c (bus_policy_append_rule): fix * bus/test-main.c (main): check for memleaks * dbus/dbus-test.c (dbus_internal_do_not_use_run_tests): make test suite check for memleaks * dbus/dbus-memory.c: add support in test mode for tracking number of outstanding blocks
Diffstat (limited to 'dbus/dbus-bus.c')
-rw-r--r--dbus/dbus-bus.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/dbus/dbus-bus.c b/dbus/dbus-bus.c
index c05d74a5..7a539382 100644
--- a/dbus/dbus-bus.c
+++ b/dbus/dbus-bus.c
@@ -63,24 +63,12 @@ static int bus_data_slot_refcount = 0;
/**
* Lock for bus_data_slot and bus_data_slot_refcount
*/
-static DBusMutex *slot_lock;
-
-/**
- * Initialize the mutex used for bus_data_slot
- *
- * @returns the mutex
- */
-DBusMutex *
-_dbus_bus_init_lock (void)
-{
- slot_lock = dbus_mutex_new ();
- return slot_lock;
-}
+_DBUS_DEFINE_GLOBAL_LOCK (bus);
static dbus_bool_t
data_slot_ref (void)
{
- dbus_mutex_lock (slot_lock);
+ _DBUS_LOCK (bus);
if (bus_data_slot < 0)
{
@@ -88,7 +76,7 @@ data_slot_ref (void)
if (bus_data_slot < 0)
{
- dbus_mutex_unlock (slot_lock);
+ _DBUS_UNLOCK (bus);
return FALSE;
}
@@ -97,7 +85,7 @@ data_slot_ref (void)
bus_data_slot_refcount += 1;
- dbus_mutex_unlock (slot_lock);
+ _DBUS_UNLOCK (bus);
return TRUE;
}
@@ -105,7 +93,7 @@ data_slot_ref (void)
static void
data_slot_unref (void)
{
- dbus_mutex_lock (slot_lock);
+ _DBUS_LOCK (bus);
_dbus_assert (bus_data_slot_refcount > 0);
_dbus_assert (bus_data_slot >= 0);
@@ -118,7 +106,7 @@ data_slot_unref (void)
bus_data_slot = -1;
}
- dbus_mutex_unlock (slot_lock);
+ _DBUS_UNLOCK (bus);
}
static void