diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:21:59 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:21:59 +0200 |
commit | d4af25c52a28b93484ffb55e0a8027bc4ce7856f (patch) | |
tree | 853d57468d6b370711e7a5dd2c3dc7d5bac81b10 /lib/parallel_scan.cpp | |
parent | 5.8 (diff) | |
download | FreeFileSync-d4af25c52a28b93484ffb55e0a8027bc4ce7856f.tar.gz FreeFileSync-d4af25c52a28b93484ffb55e0a8027bc4ce7856f.tar.bz2 FreeFileSync-d4af25c52a28b93484ffb55e0a8027bc4ce7856f.zip |
5.9
Diffstat (limited to 'lib/parallel_scan.cpp')
-rw-r--r-- | lib/parallel_scan.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/parallel_scan.cpp b/lib/parallel_scan.cpp index e8b13003..b9d29699 100644 --- a/lib/parallel_scan.cpp +++ b/lib/parallel_scan.cpp @@ -539,7 +539,11 @@ void zen::fillBuffer(const std::set<DirectoryKey>& keysToRead, //in zen::ScopeGuard guardWorker = zen::makeGuard([&] { 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::for_each(worker.begin(), worker.end(), [](boost::thread& wt) + { + if (wt.joinable()) //this is a precondition of thread::join()!!! Latter will throw an exception if violated! + wt.join(); //in this context it is possible a thread is *not* joinable anymore due to the thread::timed_join() below! + }); }); std::shared_ptr<AsyncCallback> acb = std::make_shared<AsyncCallback>(); |