backgrounding dirwatcher creation

René J.V. Bertin rjvbertin at gmail.com
Tue Sep 19 20:45:15 UTC 2017


Hi,

After those last timing measurements I made of dirwatcher creation on a large project on Mac I decided to have a look at KDirWatch to see if it can be modified not to block the calling thread's event loop. In itself that's trivial, but I quickly realised that the it's not at all a good idea to use the newly gained event handling to quit the application or close the project being opened. Doing so yanks the KDirWatch instance out from under itself, and causes a crash.

I take it that means that we'd have to run the dirwatcher creation on a background ourselves, also handling the entire directory traversal or else prevent closing the project while the creation job is running, idem for application exit (if that's even possible).

Thoughts?

FWIW, I read the Mac's FSEvent API introduction: it's supposed to be fast and lightweight. That doesn't of course mean it's fast to set up too, and all it does is notify directories in which something changed. 


More information about the KDevelop-devel mailing list