[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: Havoc Pennington <hp () redhat ! com>
Date: 2006-05-28 19:37:12
Message-ID: 4479FBE8.3060409 () redhat ! com
[Download RAW message or body]
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic