the main loop

Havoc Pennington hp at pobox.com
Mon Sep 15 13:33:44 PDT 2008


Hi,

On Mon, Sep 15, 2008 at 1:40 PM, sfora dim <sfora.dim at gmail.com> wrote:
> I have compiled and tested the example in
> http://dbus.freedesktop.org/doc/dbus/dbus-example.c.
> This is its main loop - it periodically reads new messages using the
> dbus_connection_read_write() function, and that's it. I can't see any
> callbacks registering or other library calls. why isn't it good (i
> have compiled and run it, and it seems to work and receive all the
> messages I've sent it) ?

This will work fine as long as your program never does anything except
receive dbus messages. If it does anything else, then it will block
doing the something else when it should be getting dbus messages, or
vice versa. The main loop is a solution to the problem that you can
only block in one place at a time.

Havoc


More information about the dbus mailing list