Sending new messages from a signal handler

Lucas C. Villa Real lucasvr at gobolinux.org
Thu Dec 4 12:00:48 PST 2008


Hi, all,

We're currently doing the last steps in splitting a legacy application
in 2 halves, and we're using DBus for that.

In our original code we had a few situations in which the bottom half
had to signal an event to the upper half, and the latter would then
have to perform a couple of operations before the lower half could
continue its work. Those operations involved calling a few methods
from the lower half, though.

When we ported our code to DBus we tried to mimic that logic, but
things are not working right. So we basically wrote it like this:

1 - The UpperHalf registers a signal callback
2 - The LowerHalf sends a signal whenever something interesting happens
3 - The UpperHalf receives that signal, and then sends some messages
to the LowerHalf
4 - The LowerHalf replies to that message
5 - The UpperHalf handles the reply, and then leaves the signal handler

The logic currently stops working in step 3, when the UpperHalf tries
to send a message to the LowerHalf before leaving the signal handler.
No reply is sent from the LowerHalf.

It might be worth noting that both processes connect to the same
interface (the LowerHalf is the owner), and only the LowerHalf
receives messages, while only the UpperHalf receives signals. Also, in
the LowerHalf we use g_main_loop_run(), whereas in the UpperHalf we
call g_main_context_iteration().

Does this logic we're attempting to use go against DBus concepts or
current implementation? Is there any reason why it shouldn't work, or
do you think that's more likely to be a bug in our code?

Many thanks in advance, and thanks for your hard work!
Lucas


More information about the dbus mailing list