Re: Problems with dbus_connection_borrow_message

Simon McVittie <simon.mcvittie-ZGY8ohtN/[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Organization Collabora Ltd.
Message-ID <[email protected]>
On 24/02/15 15:03, itchy_2390 wrote:
> I think I got a little bit further If I call
> dbus_connection_read_write_dispatch instead of dbus_connection_read_write I
> get the signals. But I'm not sure I understand the difference between these
> two functions.

It's very simple, one of them dispatches and the other one doesn't :-)
But I realise it isn't entirely obvious what "dispatch" means.

"read_write" in this context means doing the actual socket I/O: writing 
outgoing messages to the socket until the buffer is full or there is 
nothing more to write, and putting incoming messages in a queue inside 
the DBusConnection until a limit is reached or there is nothing more to 
read.

"dispatch" means draining that queue by handing out messages to their 
correct recipients: DBusPendingCall objects that expect replies for 
outgoing method calls, the filter functions that I recommended you 
should use for signals, and object-path handlers for incoming method calls.

Popping/borrowing/stealing messages from the connection takes them off 
the queue directly, bypassing the dispatching code. You probably don't 
want that: even the dbus-daemon and the dbus-monitor tool don't do that 
(they use filters), and they're quite low-level themselves.

-- 
Simon McVittie
Collabora Ltd. <http://www.collabora.com/>

_______________________________________________
dbus mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dbus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.