how to get the DBusConnection for dbus_connection_dispatch from a DBusWatch of a DBusServer ?

Thiago Macieira thiago at kde.org
Thu Jun 18 06:22:38 PDT 2009


Alexander Neundorf wrote:
>> This is true of the connection watches and timeouts also really; you
>> don't dispatch when the watch is ready, you dispatch when dispatch
>> status changes. (set_dispatch_status_function or whatever)
>
>I don't understand what you mean.
>Is it correct to call poll() on all the file descriptors ?
>What should I do then ?
>If I don't call dbus_connection_dispatch(), who will call this status
>callback ?
>Can you please elaborate a bit ?

When handling a DBusWatch, you just call dbus_watch_handle(). You 
shouldn't call the dispatch function just because you received activity on 
the socket.

If the Watch handling found that it needed dispatch, the DBusConnection 
object will make a callback indicating that the dispatch status changed, 
so your mainloop integration should call dispatch(). But this is not the 
case here, since you don't have a DBusConnection.

In the case of a DBusServer, there will be another callback, which 
indicates that a new connection has been accepted.

-- 
  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/20090618/cb13abf0/attachment.pgp 


More information about the dbus mailing list