C API tutorial

Matthew Johnson dbus at matthew.ath.cx
Wed Nov 2 04:14:48 PST 2005


On Tue, 1 Nov 2005, Havoc Pennington wrote:

> The shared connection never closes (which of its users would close it?
> there's no way to know when it's OK to close)
>
> Here is some rambling about that:
> http://lists.freedesktop.org/pipermail/dbus/2005-September/003360.html

The cached idea is how I would expect shared bus connections to work.


> For what you're doing dbus_bus_get_private() is probably right, though
> if you don't use any libraries the global bus is effectively private
> too.

dbus_bus_get_private() doesn't exist in the current API, I'll leave it
as dbus_bus_get() atm, but comment that close shouldn't be called except
when the process is exiting. dbus_connection_open() and
dbus_connection_open_private() might do similar functions, but they have
different syntax, and I've no idea what one needs to do to setup a
connection using them.

http://www.matthew.ath.cx/projects/dbus-example.c should have all the
fixes, working on the tutorial itself. I've also changed it to use
dbus_connection_read_write(); msg = dbus_connection_pop_message(); if we
want to separate the two. Possibly dbus_connection_read_write(false) to
allow blocking and non-blocking?

Matt

-- 
Matthew Johnson
http://www.matthew.ath.cx/


More information about the dbus mailing list