Watches and main loops

Thiago Macieira thiago at
Mon Feb 4 23:45:17 PST 2008

Marcin ‘Qrczak’ Kowalczyk wrote:
>Eh, I got no responses...
>Let me repeat one of the questions which matters the most:
>> dbus_watch_get_flags() is documented to return a subset of
>> DBUS_WATCH_READABLE and DBUS_WATCH_WRITABLE. Is it true that it always
>> contains either DBUS_WATCH_READABLE or DBUS_WATCH_WRITABLE, but not
>> both? It seems to be true in practice, and there is a rationale
>> (either direction can be toggled independently, assuming that a watch
>> never changes its flags once created, and I am making use of this
>> assumption).
>> If it was always true and documented as such, then I could make a
>> minor simplification in my binding code. Actually I already make a
>> minor violation: if dbus_watch_get_flags() lists both directions
>> (which I suppose is impossible) and fd is ready in both directions,
>> then I make two dbus_watch_handle() calls, each reporting only one
>> direction.

If it's not documented as such, do not assume as much.

Therefore, be prepared for one single watch on the same fd to be both used 
for read and write watching.

  Thiago Macieira  -  thiago (AT) - thiago (AT)
    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 : 

More information about the dbus mailing list