dbus_connection_send_with_reply_and_block and unrelated messages
Havoc Pennington
hp at redhat.com
Sun May 28 12:37:12 PDT 2006
Daniel P. Berrange wrote:
>
> 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.
>
The basic intent is that anytime you have dbus read from the socket
(which would include all blocking functions, and an explicit
dbus_connection_read_write), you need to check the dispatch status prior
to returning to poll/select.
So the above is one approach, you can also use get_dispatch_status() or
the set_dispatch_status_func() as two ways to get the dispatch status
without having to actually dispatch. The dispatch_status_func is called
in all kinds of crazy contexts so I would be sure to only _queue_
dispatch in there, don't try to actually dispatch or the reentrancy will
get dangerous.
Havoc
More information about the dbus
mailing list