[prev in list] [next in list] [prev in thread] [next in thread]
List: freedesktop-dbus
Subject: Re: C-API Examples
From: Thiago Macieira <thiago.macieira () trolltech ! com>
Date: 2006-05-08 18:43:37
Message-ID: 200605082043.38518.thiago.macieira () trolltech ! com
[Download RAW message or body]
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
[Attachment #3 (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic