Tracking DBusWatches
Havoc Pennington
hp at redhat.com
Fri Feb 9 10:41:58 PST 2007
Thiago Macieira wrote:
> Havoc Pennington wrote:
>> This should be fine (with as you say the problem that your reply
>> notifier is run in the other thread). The problem I mentioned would
>> happen if you used send_with_reply_and_block(), because only one thread
>> can block at a time or one of them gets stuck waiting for the socket
>> lock.
>
> Even if you use a non-blocking method (like send_with_reply), the thread
> that is doing the read_write doesn't know that there's more data. So it
> won't wake up and, therefore, won't send a thing.
>
Right... with a main loop, the wakeup_main() function is supposed to
solve this. Since there's no way to wake up read_write(), it's not
helpful to set a wakeup function in the no-main-loop case.
As you say the solution would be to add a pipe that read_write() also
selects on. This is how g_main_context_wakeup() works with the GLib main
loop.
Hmm. Well, for now I guess any app beyond simple command line apps just
has to use a full main loop.
Havoc
More information about the dbus
mailing list