diff options
author | Alexander Larsson <alexl@redhat.com> | 2003-02-26 15:52:25 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2003-02-26 15:52:25 +0000 |
commit | 89e6dfd29cfbdb92f15e8fb2bde76d94a4c5a7b3 (patch) | |
tree | 501540fab4797ab07a4f90e239ac6dabb5bec38d /dbus/dbus-dataslot.c | |
parent | 7265423411609c14ddb9e6643463b840afcaa09b (diff) |
2003-02-26 Alexander Larsson <alexl@redhat.com>
* configure.in:
Set DBUS_GLIB_THREADS_LIBS for apps using gthread-2.0
* dbus/dbus-connection.c:
* dbus/dbus-connection.h:
Fix _dbus_connection_acquire_io_path and _dbus_connection_acquire_dispatch.
Add dbus_connection_set_wakeup_main_function and use it when queueing
incoming and outgoing messages.
* dbus/dbus-dataslot.c:
Threadsafe usage of DBusDataSlotAllocator
* dbus/dbus-message.c: (dbus_message_get_args_iter):
dbus_new can fail.
* dbus/dbus-server-unix.c:
Add todo comment
* glib/dbus-gmain.c:
Implement the new wakeup functions for glib.
* glib/Makefile.am:
* glib/test-thread-client.c:
* glib/test-thread-server.c:
* glib/test-thread.h:
Initial cut at some thread test code. Not really done yet.
Diffstat (limited to 'dbus/dbus-dataslot.c')
-rw-r--r-- | dbus/dbus-dataslot.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/dbus/dbus-dataslot.c b/dbus/dbus-dataslot.c index a5909ffc..53fb9e4c 100644 --- a/dbus/dbus-dataslot.c +++ b/dbus/dbus-dataslot.c @@ -177,9 +177,18 @@ _dbus_data_slot_list_set (DBusDataSlotAllocator *allocator, DBusFreeFunction free_data_func, DBusFreeFunction *old_free_func, void **old_data) -{ +{ +#ifndef DBUS_DISABLE_ASSERT + /* We need to take the allocator lock here, because the allocator could + * be e.g. realloc()ing allocated_slots. We avoid doing this if asserts + * are disabled, since then the asserts are empty. + */ + if (!dbus_mutex_lock (allocator->lock)) + return FALSE; _dbus_assert (slot < allocator->n_allocated_slots); _dbus_assert (allocator->allocated_slots[slot] == slot); + dbus_mutex_unlock (allocator->lock); +#endif if (slot >= list->n_slots) { @@ -227,8 +236,17 @@ _dbus_data_slot_list_get (DBusDataSlotAllocator *allocator, DBusDataSlotList *list, int slot) { +#ifndef DBUS_DISABLE_ASSERT + /* We need to take the allocator lock here, because the allocator could + * be e.g. realloc()ing allocated_slots. We avoid doing this if asserts + * are disabled, since then the asserts are empty. + */ + if (!dbus_mutex_lock (allocator->lock)) + return FALSE; _dbus_assert (slot < allocator->n_allocated_slots); _dbus_assert (allocator->allocated_slots[slot] == slot); + dbus_mutex_unlock (allocator->lock); +#endif if (slot >= list->n_slots) return NULL; |