using the wakeup_main_function together with dispatch_status_function
Thiago Macieira
thiago at kde.org
Thu Sep 25 23:40:16 PDT 2008
Havoc Pennington wrote:
>iirc dispatch status function was added because in some cases messages
>could appear in the incoming queue even though dbus_watch_handle()
>hadn't been called. Originally you were supposed to just always
>dispatch after handling a watch. I don't remember what the cases are.
When you're doing dbus_connection_send_with_reply_and_block(), the
blocking thread will read from the socket and process messages until it
receives the reply (or the timeout occurs, whichever comes first). But
any other messages received are not dispatched. They are just queued for
later.
That's why it has to dispatch again.
QtDBus checks the dispatch status after doing a blocking call. But I have
a pending task to use the wake-up function since that wasn't enough:
there are other places where and_block() may be called (add_match,
remove_match, etc.).
>One example might be a timeout expiring resulting in a synthetic error
>message created on client side.
Yep, that one too. Though this one is easy to catch because there's a
DBusTimeout expiring. So you can usually be sure that, once that happens,
there's something to be dispatched.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20080926/e73734a6/attachment.pgp
More information about the dbus
mailing list