How to avoid client side polling?

Fan Wu wufan9418 at gmail.com
Sun Jul 29 14:27:19 PDT 2007


Hi Thiago,

Thanks for the link! I will take a look.

Fan

On 7/29/07, Thiago Macieira <thiago at kde.org> wrote:
> Fan Wu wrote:
> >>Yes, there is. Have it select as well on a pipe, onto which you can
> >> write to make the loop wake up. We use that technique in Qt.
> >
> >Could you please show me a link to the Qt code that does this?
>
> You can find one example here:
> http://websvn.kde.org/trunk/qt-copy/src/corelib/kernel/qeventdispatcher_unix.cpp?view=markup
>
> and another here:
> http://websvn.kde.org/trunk/qt-copy/src/corelib/kernel/qeventdispatcher_glib.cpp?view=markup
>
> Take a look at the wakeUp functions and search for "thread_pipe" to see
> where it's used.
>
> >> You want to have a select-based event loop in your application and
> >> just plug the DBusConnection socket descriptor into it. Like I
> >> described in the previous email.
> >
> >Are you suggesting writing a mainloop which polls the file descriptor
> >of DBusConnection, as well as a pipe specifically added to wake up the
> >select sleep?
>
> I am suggesting you integrate the DBusConnection file descriptor into your
> application's existing mainloop. You must have one already to obtain
> events from the system, for timers and for sockets.
>
> --
>  Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>   PGP/GPG: 0x6EF45358; fingerprint:
>   E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
>
>


More information about the dbus mailing list