[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-dbus
Subject:    Re: dbus_connection_send_with_reply_and_block and unrelated messages
From:       "Daniel P. Berrange" <dan () berrange ! com>
Date:       2006-05-28 15:17:52
Message-ID: 20060528151752.GA1446 () berrange ! com
[Download RAW message or body]


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@redhat.com  -  Daniel Berrange  -  dan@berrange.com    -=|

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic