diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:16:21 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:16:21 +0200 |
commit | 88a2d0007db222c339f0b6a17794a2014a241892 (patch) | |
tree | 75105ef49b3a52b7ee176a1ad480e7652e49825f /lib/parallel_scan.cpp | |
parent | 4.2 (diff) | |
download | FreeFileSync-88a2d0007db222c339f0b6a17794a2014a241892.tar.gz FreeFileSync-88a2d0007db222c339f0b6a17794a2014a241892.tar.bz2 FreeFileSync-88a2d0007db222c339f0b6a17794a2014a241892.zip |
4.3
Diffstat (limited to 'lib/parallel_scan.cpp')
-rw-r--r-- | lib/parallel_scan.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/parallel_scan.cpp b/lib/parallel_scan.cpp index 96b167b8..1052a408 100644 --- a/lib/parallel_scan.cpp +++ b/lib/parallel_scan.cpp @@ -141,7 +141,7 @@ Windows 7: Windows XP: 1 Thread: 41s | 13s 1 Thread: 45s | 13s 2 Threads: 42s | 11s 2 Threads: 38s | 8s -=> Traversing does not take any advantage of file locality so that even multiple threads operating on the same disk impose no performance overhead! +=> Traversing does not take any advantage of file locality so that even multiple threads operating on the same disk impose no performance overhead! (even faster on XP) */ @@ -196,7 +196,7 @@ public: errorMsg.clear(); errorResponse.reset(); - //dummy.unlock(); + dummy.unlock(); //optimization for condition_variable::notify_one() conditionCanReportError.notify_one(); return rv; @@ -204,13 +204,13 @@ public: void processErrors(FillBufferCallback& callback) //context of main thread, call repreatedly { - boost::lock_guard<boost::mutex> dummy(lockErrorMsg); + boost::unique_lock<boost::mutex> dummy(lockErrorMsg); if (!errorMsg.empty() && !errorResponse.get()) { FillBufferCallback::HandleError rv = callback.reportError(copyStringTo<std::wstring>(errorMsg)); //throw! errorResponse.reset(new FillBufferCallback::HandleError(rv)); - //dummy.unlock(); + dummy.unlock(); //optimization for condition_variable::notify_one() conditionGotResponse.notify_one(); } } @@ -293,6 +293,7 @@ private: }; //------------------------------------------------------------------------------------------------- + struct TraverserShared { public: @@ -372,7 +373,7 @@ void DirCallback::onFile(const Zchar* shortName, const Zstring& fullName, const Linux: retrieveFileID takes about 50% longer in VM! (avoidable because of redundant stat() call!) */ - output_.addSubFile(fileNameShort, FileDescriptor(details.lastWriteTimeRaw, details.fileSize)); + output_.addSubFile(fileNameShort, FileDescriptor(details.lastWriteTimeRaw, details.fileSize, details.id)); cfg.acb_.incItemsScanned(); //add 1 element to the progress indicator } @@ -547,8 +548,8 @@ void zen::fillBuffer(const std::set<DirectoryKey>& keysToRead, //in zen::ScopeGuard guardWorker = zen::makeGuard([&]() { - std::for_each(worker.begin(), worker.end(), std::mem_fun_ref(&boost::thread::interrupt)); //interrupt all at once, then join - std::for_each(worker.begin(), worker.end(), std::mem_fun_ref(&boost::thread::join)); + std::for_each(worker.begin(), worker.end(), [](boost::thread& wt) { wt.interrupt(); }); //interrupt all at once, then join + std::for_each(worker.begin(), worker.end(), [](boost::thread& wt) { wt.join(); }); }); std::shared_ptr<AsyncCallback> acb = std::make_shared<AsyncCallback>(); |