When is a watch added/removed?

David Henningsson diwic at ubuntu.com
Sat Jul 20 08:14:48 UTC 2019


Hi,

I'm maintaining libdbus bindings for Rust and I'm trying to improve the 
watch handling. I have two questions:

1)

*dbus_connection_set_watch_functions* takes functions to add, remove and 
toggle watches. I understand toggling watches can happen if read/write 
buffers become full or empty, but are "add" and "remove" callbacks ever 
called from anything else than dbus_connection_set_watch_functions itself?

2)

According to the documentation, a watch should not be added to the main 
loop at all if it is not enabled, but is this really true - would it not 
make sense to keep monitoring that fd for errors/hup/etc even though the 
watch is disabled (because of filled/empty buffers)?

// David



More information about the dbus mailing list