From 4adc08bb12e425d9be2a455ef1353738fb4cfe4c Mon Sep 17 00:00:00 2001 From: Coos Baakman Date: Mon, 28 Nov 2016 15:04:58 +0100 Subject: [PATCH] bugfix: run the file threads first to prevent the queue from running full and hanging forever --- src/M6Builder.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/M6Builder.cpp b/src/M6Builder.cpp index 02f0b5a..32d5f87 100644 --- a/src/M6Builder.cpp +++ b/src/M6Builder.cpp @@ -560,6 +560,11 @@ void M6Processor::Process(vector& inFiles, M6Progress& inProgress, if (inNrOfThreads > inFiles.size()) inNrOfThreads = static_cast(inFiles.size()); */ + for (uint32 i = 0; i < inNrOfThreads; ++i) + mFileThreads.create_thread( + [&inProgress, this]() { this->ProcessFile(inProgress); } + ); + for (fs::path& file : inFiles) { if (not (mException == std::exception_ptr())) @@ -578,11 +583,6 @@ void M6Processor::Process(vector& inFiles, M6Progress& inProgress, // Now all the input files have been added to the queue. - for (uint32 i = 0; i < inNrOfThreads; ++i) - mFileThreads.create_thread( - [&inProgress, this]() { this->ProcessFile(inProgress); } - ); - mFileThreads.join_all(); }