How to avoid client side polling?

Thiago Macieira thiago at kde.org
Sun Jul 29 07:10:56 PDT 2007


Fan Wu wrote:
>/**
> * @todo We need to have a way to wake up the select sleep if
> * a new iteration request comes in with a flag (read/write) that
> * we're not currently serving. Otherwise a call that just reads
> * could block a write call forever (if there are no incoming
> * messages).
> */
>
>So I guess at this time there is no off-the-shelf way to interrupt a
>select sleep.

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.

>Comments?

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.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20070729/0f76e3b4/attachment.pgp 


More information about the dbus mailing list