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

Reply via email to