D10702: Always use a job to delete files to avoid freezing process waiting on IO
Mark Gaiser
noreply at phabricator.kde.org
Wed Feb 21 22:28:25 UTC 2018
markg added a comment.
While this might give you the expected result, it feels like a workaround.
I'm assuming the fast path is there for a reason and is really substantially faster then going through the job route.
If that is the case then the proper fix would be to make that code part async. That is obviously much more complex (otherwise it would've been done already).
Think of using std::async and a QEventLoop. Sounds difficult, right? It is :) But I've been playing with that kind of stuff lately so i'm happy to share an example that you can use as a starting point.
Here it is: https://p.sc2.nl/BygE-Oiwz
I wanted to paste it inline, but that already got quite big so a link it is.
I've added a bunch of comments in the code to explains what it's doing.
Note that the example does make a "QEventLoop", you should **not** do that within the if statement, but rather outside the while loop and simply call exec() and quit() every time (not making a new QEventLoop for every delete)
Lastly, please benchmark this fast pats (as it currently is) compared to your KIO version and my async version to see if the fast path really is the fast path. As we just don't know and that kinda influences which route to choose here.
REPOSITORY
R241 KIO
REVISION DETAIL
https://phabricator.kde.org/D10702
To: meven, #frameworks, dfaure, ngraham, #dolphin
Cc: markg, ngraham, #frameworks, michaelh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180221/7afd65aa/attachment.html>
More information about the Kde-frameworks-devel
mailing list