D8536: Add more hashing algorithms to KPropertiesDialog

Anthony Fieroni noreply at phabricator.kde.org
Wed Dec 27 18:39:08 UTC 2017


anthonyfieroni added inline comments.

INLINE COMMENTS

> petermajchrak wrote in kpropertiesdialog.cpp:2798-2804
> I can add two critical sections, one for reading the cache and one for writing while the hash computation is not in either of them

Basically you need computation only one time when you don't have cache so you can check if cache does not exist then make a future watcher. In this case you can use blockedMappedReduced to wait all threads and mapper function looks like

  std::function<QString(QCryptographicHash::Algorithm)> mapper = [this, path](QCryptographicHash::Algorithm alg) {
      const QString checksum = computeChecksum(alg, path);
       QMutexLocker locker(&d->mutex);
       cacheChecksum(checksum, alg);
  }

REPOSITORY
  R241 KIO

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

To: petermajchrak, elvisangelaccio, #vdg, colomar
Cc: colomar, anthonyfieroni, bcooksley, alexeymin, ngraham, elvisangelaccio, #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20171227/33295dc8/attachment.html>


More information about the Kde-frameworks-devel mailing list