summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-list.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-list.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-list.c')
-rw-r--r--dbus/dbus-list.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/dbus/dbus-list.c b/dbus/dbus-list.c
index 4c530dc7..b2efff6c 100644
--- a/dbus/dbus-list.c
+++ b/dbus/dbus-list.c
@@ -35,19 +35,7 @@
*/
static DBusMemPool *list_pool;
-static DBusMutex *list_pool_lock = NULL;
-
-/**
- * Initializes the global mutex used for allocating list nodes.
- *
- * @returns the mutex
- */
-DBusMutex *
-_dbus_list_init_lock (void)
-{
- list_pool_lock = dbus_mutex_new ();
- return list_pool_lock;
-}
+_DBUS_DEFINE_GLOBAL_LOCK (list);
/**
* @defgroup DBusListInternals Linked list implementation details
@@ -67,7 +55,7 @@ alloc_link (void *data)
{
DBusList *link;
- if (!dbus_mutex_lock (list_pool_lock))
+ if (!_DBUS_LOCK (list))
return NULL;
if (!list_pool)
@@ -76,7 +64,7 @@ alloc_link (void *data)
if (list_pool == NULL)
{
- dbus_mutex_unlock (list_pool_lock);
+ _DBUS_UNLOCK (list);
return NULL;
}
}
@@ -85,7 +73,7 @@ alloc_link (void *data)
if (link)
link->data = data;
- dbus_mutex_unlock (list_pool_lock);
+ _DBUS_UNLOCK (list);
return link;
}
@@ -93,13 +81,13 @@ alloc_link (void *data)
static void
free_link (DBusList *link)
{
- dbus_mutex_lock (list_pool_lock);
+ _DBUS_LOCK (list);
if (_dbus_mem_pool_dealloc (list_pool, link))
{
_dbus_mem_pool_free (list_pool);
list_pool = NULL;
}
- dbus_mutex_unlock (list_pool_lock);
+ _DBUS_UNLOCK (list);
}
static void