Tracking DBusWatches
Havoc Pennington
hp at redhat.com
Thu Feb 8 07:49:41 PST 2007
Thiago Macieira wrote:
> Havoc Pennington wrote:
>> libdbus is fairly thread-safe but does have some quirks that need
>> fixing, for example you can have issues if you
>> dbus_connection_send()/dbus_connection_flush() in the main thread and do
>> a blocking read_write() in another thread. (See a recent discussion on
>> this list.) This is a bug in libdbus but perhaps hard to fix.
>
> I don't think this should be considered a bug in libdbus, but in the
> application.
>
> If you're blocking on one thread, you can't use a blocking function on
> another.
>
I think it's pretty useful to have a dispatch or read_write thread, and
still send from other threads. You are probably right that flush()
doesn't make sense in this context, but perhaps we at least should make
send() wake up the thread blocking in read_write, or something like that.
Another approach, we could separate the lock on the socket into a
read-from-socket lock and a write-to-socket lock in theory, though in
practice with the current code structure this would be painful.
Havoc
More information about the dbus
mailing list