From e5b41954cd14d235c62f51086a43cf6dbb1d8058 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 10 Feb 2009 12:00:12 -0500 Subject: [PATCH] Bug 857 - Update DBusConnection documentation to warn about threadsafety We're not currently threadsafe, and the documentation should really reflect that. Even better would be to fix it of course. --- dbus/dbus-connection.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-) diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c index a960a99..3beb691 100644 --- a/dbus/dbus-connection.c +++ b/dbus/dbus-connection.c @@ -166,10 +166,20 @@ * the last message in the queue (obviously no messages are received * after disconnection). * - * After calling dbus_threads_init(), #DBusConnection has thread - * locks and drops them when invoking user callbacks, so in general is - * transparently threadsafe. However, #DBusMessage does NOT have - * thread locks; you must not send the same message to multiple + * WARNING: #DBusConnection is not currently fully threadsafe. Some + * work has been done, but it is not complete, and there are known issues. + * The API has been designed such that it should be possible to make it + * threadsafe in the future. + * + * First, it's recommended for your application to (exclusively) use an event-driven + * architecture; i.e. a mainloop. + * + * But to use threads currently, you first should call dbus_threads_init(). + * Next, you can retrieve private connections using dbus_connection_open_private. + * This is far from ideal, but will work. + * + * Note that even when in the future #DBusConnection is made thread safe, + * #DBusMessage does NOT have thread locks; you must not send the same message to multiple * #DBusConnection if those connections will be used from different threads, * for example. * -- 1.6.0.6