how does dbus know

sfora dim sfora.dim at gmail.com
Thu Sep 25 07:50:20 PDT 2008


Hello Jim,

I think what Thiago is saying that if you use poll or select, the
other thread will send the message without waking
you up. this is because you don't lock the transport
of dbus when you block on these system calls.

I hope that I'm not wrong here because I am not
a dbus expert !

Yours,
Sfora.

On Thu, Sep 25, 2008 at 2:06 PM, jim harvey <jimharvy at gmail.com> wrote:
>
>> From: Thiago Macieira <thiago at kde.org>
>> Date: Tue, Sep 23, 2008 at 5:34 PM
>> Subject: Re: how does dbus know
>> To: dbus at lists.freedesktop.org
>>
>>
>> On Tuesday 23 September 2008 13:18:19 sfora dim wrote:
>> > My question is how does the main loop knows to wake up in order
>> > to call dbus ?
>>
>> There's a callback function that you set in the DBusConnection that is
>> supposed to wake up the mainloop, if necessary. That's up to you to
>> implement
>> it. Most mainloops keep a pipe on constant poll so that other threads can
>> wake
>> it up by just writing to the pipe.
>>
>> But if the polling thread isn't holding the transport locked (i.e., it's a
>> real poll(2) or select(2), not dbus_connection_read_write), then the other
>> thread will attempt to send the data directly, without interfering with
>> the
>> main thread. Only if it can't will it change the status of the write
>> Watch.
>
> let me get this straight - lets say I use poll() and have a multi threaded
> application, with many threads performing
> methods calls. when a thread (not the main) sends a message, will one of the
> FDs in the DBusWatch structures
> i'm poll()-ing on get signalled?
> or must i use the set_wakeup_main_function to set a my_wakeup_main()
> function that manually wakes up the main thread
> from the poll() (via a dedicated FD i am signaling)?
>
> Regards,
> Jim
>
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
>
>


More information about the dbus mailing list