the main loop

sfora dim sfora.dim at gmail.com
Mon Sep 15 21:46:14 PDT 2008


Hi Havoc,

On Mon, Sep 15, 2008 at 11:33 PM, Havoc Pennington <hp at pobox.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.
>
> 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.

And if I create a dedicated thread just for this main loop, and let my
program do anything it wants in its other threads, is it ok ?

Thank you!
Sfora


More information about the dbus mailing list