C-API Examples
Thiago Macieira
thiago.macieira at trolltech.com
Mon May 8 11:43:37 PDT 2006
Kosina, Martin wrote:
>That would be the case (dbus-only scenario) - trouble is, this ends up
>being a tight loop, pegging the CPU. Any good bare-bones C samples I
>could refer to for setting up/using the loops and watches? I am not that
>familiar with Glib or Qt, so reverse-engineering the existing bindings
>has been slooow.
Feel free to ask if you have a question in my code.
But, basically, the main loop boils down to:
- a central place that does select(2) on all sockets
- when the D-BUS socket is activated for read, the binding calls
dbus_watch_handle and then dbus_connection_dispatch (as long as
DBUS_DISPATCH_DATA_REMAINS)
- when the socket is activated for writing, we just call dbus_watch_handle
There are some other callbacks like the timers: the select(2) call is
limited on timeout on the shortest timer pending.
--
Thiago José Macieira - thiago.macieira AT trolltech.com
Trolltech AS - Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20060508/c5ab0f60/attachment.pgp
More information about the dbus
mailing list