How to avoid client side polling?

Thiago Macieira thiago at kde.org
Sat Jul 28 06:01:35 PDT 2007


Fan Wu wrote:
>Please let me know if you have comments or better solutions.

You didn't give us enough information on what your needs are to give you a 
proper solution. So I can only give you a generic one:

Replace your blocking calls with asynchronous calls. That is, send the 
request over D-Bus and go back to your main loop event handler. That is, 
into your select()-based loop. Whenever there's data available in the 
D-Bus socket, you'll be notified and you can then (and only then) wake 
up, tell DBusConnection to process the data and continue your execution.

No blocking, no threads.

-- 
  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/20070728/c5e4fb90/attachment.pgp 


More information about the dbus mailing list