gorakhargosh/watchdog — pull request #167 by gergelyerdelyi (2013-06-25 09:53:35+00:00)
Title: Windows: more graceful handling external deletion of watched folders

In case a watched folder is deleted ReadDirectoryChangesW() fails with an 'Access denied' (error code 5). In case of that error, it is better to let the event emitter thread die. Otherwise it goes into a busy-loop, polling the non-existant folder, eating 100% CPU.

Also in this patch, the error mentioned above is silenced in the main loop to avoid the tracebacks which can not be handled by the application anyway.

Though this pull request fixes the most important problem, in the future these kind of situations could be turned into events that the application could handle itself.