D15180: kioexecd: watch for creations or modifications of the temporary files

David Faure noreply at phabricator.kde.org
Wed Sep 5 09:24:10 BST 2018


dfaure requested changes to this revision.
dfaure added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> kioexecd.cpp:36
>  
> +const int predefinedTimeout = 30000; // 30s
> +

static const int...

> kioexecd.cpp:86
> +{
> +    m_deleted_mutex.lock();
> +    m_deleted.remove(path);

Why is there a mutex at all, in this single-threaded code? This doesn't make sense to me.

> kioexecd.cpp:133
> +    for (auto it = m_deleted.begin(); it != m_deleted.end();) {
> +        if (it.value().msecsTo(QDateTime::currentDateTime()) >= predefinedTimeout) {
> +            qCDebug(KIOEXEC) << "Going to forget" << it.key();

Move the call to currentDateTime() outside of the loop, so it happens only once.
It's much more costly than one might think (because of timezone conversion, which uses tzset() etc.)

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D15180

To: jtamate, #frameworks, broulik, ngraham, dfaure, elvisangelaccio
Cc: anthonyfieroni, elvisangelaccio, kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180905/75e00461/attachment.html>


More information about the Kde-frameworks-devel mailing list