<div dir="ltr"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
From: Thiago Macieira <<a href="mailto:thiago@kde.org">thiago@kde.org</a>><br>
Date: Tue, Sep 23, 2008 at 5:34 PM<br>
Subject: Re: how does dbus know<br>
To: <a href="mailto:dbus@lists.freedesktop.org">dbus@lists.freedesktop.org</a><br>
<br>
<br>
On Tuesday 23 September 2008 13:18:19 sfora dim wrote:<br>
> My question is how does the main loop knows to wake up in order<br>
> to call dbus ?<br>
<br>
There's a callback function that you set in the DBusConnection that is<br>
supposed to wake up the mainloop, if necessary. That's up to you to implement<br>
it. Most mainloops keep a pipe on constant poll so that other threads can wake<br>
it up by just writing to the pipe.<br>
<br>
But if the polling thread isn't holding the transport locked (i.e., it's a<br>
real poll(2) or select(2), not dbus_connection_read_write), then the other<br>
thread will attempt to send the data directly, without interfering with the<br>
main thread. Only if it can't will it change the status of the write Watch.</blockquote><div><br>let me get this straight - lets say I use poll() and have a multi threaded application, with many threads performing<br>
methods calls. when a thread (not the main) sends a message, will one of the FDs in the DBusWatch structures <br>i'm poll()-ing on get signalled?<br>or must i use the set_wakeup_main_function to set a my_wakeup_main() function that manually wakes up the main thread <br>
from the poll() (via a dedicated FD i am signaling)?<br><br></div></div>Regards,<br>Jim<br></div>