dbus_connection_send_with_reply_and_block and unrelated messages

Daniel P. Berrange dan at berrange.com
Sun May 28 08:17:52 PDT 2006


On Sun, May 28, 2006 at 03:22:01PM +0200, Thiago Macieira wrote:
> I've noticed a problem when debugging some initial KDE tests, which is the 
> fact that dbus_connection_send_with_reply_and_block (henceforth "the 
> function") may receive more messages other than the reply it was waiting 
> for. The binding never gets notified of the existance of such messages.
> 
> So I have to ask: shouldn't "the function" queue an immediate timer to 
> notify of the existance of such data? Or should the binding poll the 
> connection (dbus_connection_dispatch) to make sure that the queue is 
> empty? If the latter, should this polling be done periodically, or just 
> after a call to "the function"?

The way I dealt with this in Perl bindings is to have a pre-select/pre-poll
hook, which runs the following:

    while(dbus_connection_dispatch(con) == DBUS_DISPATCH_DATA_REMAINS);

So once we get into the select/poll function we're sure there are no 
outstanding messages to be dealt with. It seems to be working pretty
effectively thus far.

Regards,
Dan.
-- 
|=-            GPG key: http://www.berrange.com/~dan/gpgkey.txt       -=|
|=-       Perl modules: http://search.cpan.org/~danberr/              -=|
|=-           Projects: http://freshmeat.net/~danielpb/               -=|
|=-   berrange at redhat.com  -  Daniel Berrange  -  dan at berrange.com    -=|
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/dbus/attachments/20060528/4d2cc443/attachment.pgp


More information about the dbus mailing list