[prev in list] [next in list] [prev in thread] [next in thread]
List: freedesktop-dbus
Subject: Simplest mainloop that could possibly work
From: Andrew Clunis <andrew () orospakr ! ca>
Date: 2007-10-30 18:44:16
Message-ID: 1193769856.7472.15.camel () orospakr-laptop
[Download RAW message or body]
Hi guys,
I'm trying to put together a simple D-Bus mainloop inside a thread in a
service I'm writing, and using glib/qt isn't really an option.
I had originally intended to use dbus_connection_read_write_dispatch()
function, and have the other thread call
dbus_connection_send()/dbus_connection_flush(). Of course, that's no
good because dbus_connection_read_write_dispatch() blocks on read I/O.
Thus, rather comically, the messages for transmission get buffered and
are only sent once the service happens to *receive* a message.
So, it looks like I have to bite the bullet and write a non-toy
mainloop. I'm having a lot of trouble grokking the Watch/Timeout stuff,
though, and I haven't had much luck finding useful example code.
As far as I understand it, I'm supposed to call
dbus_connection_set_watch_functions() and
dbus_connection_set_timeout_functions(). I'm unclear as to what I
should do once I have a poll() loop running on the FDs, however.
Thanks in advance!
--
Regards,
Andrew Clunis
_______________________________________________
dbus mailing list
dbus@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dbus
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic