gio inotify missing file handling polling suboptimal
@walters
Submitted by Colin Walters Assigned to Alexander Larsson @alexl
Link to original bug (#522314)
Description
Currently if you add a watch for a path which doesn't exist, code in the inotify-missing.c file adds a timeout to poll for it: http://svn.gnome.org/viewvc/glib/trunk/gio/inotify/inotify-missing.c?view=markup
I think a smarter algorithm would be:
- Check if given path exists, if so goto success
- Check whether the parent exists. If not, recurse -> 1
- Check if the given path exists, if so remove previous watch, goto success
In the watch handler on the parent, we check to see if the target exists. If so, we remove the parent watch and go back down the chain.