Robert Greenwalt rgreenwalt at google.com
Wed Feb 4 13:44:48 PST 2009

I inherited a bit of code that was polling using
dbus_connection_read_write_dispatch.  It worked fine, but it was polling.  I
decided to change that to an asynchronous model and looked at the
DBusWatch/Timeout stuff but it looked like overkill for my needs.  I
continued looking and found dbus_connection_set_wakeup_main_function.  From
the comment: "This function is responsible for waking up the main loop when
some change has happened to the connection that the mainloop needs to
reconsider" it sounded perfect.  Call me when I need to do stuff and I'll do
stuff (non-polled used of read_write_dispatch).

It doesn't work.  It kinda works.  I get some incoming messages.  Outgoing
messages seem to go out.  It just those few missed messages that spoil the
whole thing.

I can go and implement the DBusWatch/Timeout interface, but I'm curious:
what purpose does dbus_connection_set_wakeup_main_function serve?  How must
it be suplimented to make a fully functional solution?  If that's not
possible, why does it remain in the API?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20090204/ae0fd354/attachment.htm 

More information about the dbus mailing list