https://bugs.kde.org/show_bug.cgi?id=384866
Bug ID: 384866 Summary: KDirWatch::addDir should pump the eventloop (call QCoreApplication::processEvents()) Product: frameworks-kcoreaddons Version: unspecified Platform: Compiled Sources OS: OS X Status: UNCONFIRMED Severity: wishlist Priority: NOR Component: general Assignee: mp...@kde.org Reporter: rjvber...@gmail.com CC: kdelibs-b...@kde.org Target Milestone: --- Setting a dirwatcher on a large tree can be quite expensive on Mac. For example, a recursive KDirWatch::addDir() on the GCC source tree will take around 85 seconds on a 2.7Ghz i7 (with a fast HDD) while the KDirWatch dtor will take roughly twice that time. Linux timings on a much slower CPU are a fraction of that and negligible in probably most contexts where you'd want to create such a dirwatcher. I think this qualifies as the kind of lengthy operation for which Qt suggests to call QCoreApplication::processEvents() periodically. That would make it less invasive to call on the main thread, as applications (developed on Linux) might be wont to do. The logical place for doing such a check would be in KDirWatchPrivate::addEntry(), just before the loop where it calls itself recursively. That can however cause a race condition: how to handle the situation where a user action leads to the destruction of the KDirWatch object itself (e.g. the user quits the application during the lengthy dirwatcher creation). -- You are receiving this mail because: You are watching all bug changes.