dbus mini-summit at Desktop Summit 2011
Rémi Denis-Courmont
remi at remlab.net
Wed Aug 10 10:10:14 PDT 2011
Le mercredi 10 août 2011 19:12:38 Will Thompson, vous avez écrit :
> • Declare that using (eg) _send_with_reply_and_block() in >1 thread is
> unsupported. We can't actually remove the connection-locking code
> because QtDBus depends on it working (inasmuch as it works). VLC (for
> instance) uses one private connection per thread, which should continue
> to be supported.
You got that from the MPRIS people?
I am afraid someone confused dbus_connection_read_write(_dispatch)() with
dbus_connection_send_with_reply_and_block().
VLC indeed uses a private connection to implement the MPRIS service. It is not
for the sake of reinventing the wheel: dbus_connection_read_write() is not
cancellation-safe (at least it's not specified), so the poll() loop had to be
reinvented just so we could destroy the DBus connection cleanly.
VLC does however use dbus_connection_send_with_reply_and_block() where it acts
as a DBus "client", i.e. the Telepathy "NowPlaying" thingy and the power
management inhibitor.
libdbus has in any case never been really thread-safe because:
- it modifies the environment variables, and
- dbus_threads_init_default() is not re-entrant.
If you want to achieve true thread-safety, you should maybe consider depending
on pthread-stubs from the XCB guys.
--
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis
More information about the dbus
mailing list