summaryrefslogtreecommitdiff
path: root/dbus/dbus-dataslot.h
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2012-02-14 19:58:56 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2012-02-21 14:41:25 +0000
commit8a58250acfeffc4e311169903f9e782fcad79547 (patch)
tree47360102b46407d931a9e4a9e1a55e13683b3f8b /dbus/dbus-dataslot.h
parent4d4da20ce7e4eebc6b4467d193cb7cec4cfeb17a (diff)
downloaddbus-8a58250acfeffc4e311169903f9e782fcad79547.tar.gz
Distinguish between two flavours of mutex
dbus-threads.h warns that recursive pthreads mutexes are not compatible with our expectations for condition variables. However, the only two condition variables we actually use only have their corresponding mutexes locked briefly (and we don't call out to user code from there), so the mutexes don't need to be recursive anyway. That's just as well, because it turns out our implementation of recursive mutexes on pthreads is broken! The goal here is to be able to distinguish between "cmutexes" (mutexes compatible with a condition variable) and "rmutexes" (mutexes which are recursive if possible, to avoid deadlocking if we hold them while calling user code). This is complicated by the fact that callers are not guaranteed to have provided us with both versions of mutexes, so we might have to implement one by using the other (in particular, DBusRMutex *aims to be* recursive, it is not *guaranteed to be* recursive). Bug: https://bugs.freedesktop.org/show_bug.cgi?id=43744 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Thiago Macieira <thiago@kde.org>
Diffstat (limited to 'dbus/dbus-dataslot.h')
-rw-r--r--dbus/dbus-dataslot.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/dbus/dbus-dataslot.h b/dbus/dbus-dataslot.h
index 2e706f72..3d9d5edd 100644
--- a/dbus/dbus-dataslot.h
+++ b/dbus/dbus-dataslot.h
@@ -57,7 +57,7 @@ struct DBusDataSlotAllocator
DBusAllocatedSlot *allocated_slots; /**< Allocated slots */
int n_allocated_slots; /**< number of slots malloc'd */
int n_used_slots; /**< number of slots used */
- DBusMutex **lock_loc; /**< location of thread lock */
+ DBusRMutex **lock_loc; /**< location of thread lock */
};
/**
@@ -72,7 +72,7 @@ struct DBusDataSlotList
dbus_bool_t _dbus_data_slot_allocator_init (DBusDataSlotAllocator *allocator);
dbus_bool_t _dbus_data_slot_allocator_alloc (DBusDataSlotAllocator *allocator,
- DBusMutex **mutex_loc,
+ DBusRMutex **mutex_loc,
int *slot_id_p);
void _dbus_data_slot_allocator_free (DBusDataSlotAllocator *allocator,
int *slot_id_p);