summaryrefslogtreecommitdiffstats
path: root/Source/cmInstallScriptHandler.cxx
diff options
context:
space:
mode:
authorMartin Duffy <martin.duffy@kitware.com>2024-09-06 19:27:41 (GMT)
committerMartin Duffy <martin.duffy@kitware.com>2024-09-09 21:36:08 (GMT)
commita980418f7b46e5ec63e3bd7b3c0e71f5e2b5ffac (patch)
tree5897741512ea32d52ce47ff06586ff634cf2e814 /Source/cmInstallScriptHandler.cxx
parenta53e8e4e81d66be262dd01bba6555e2080794652 (diff)
downloadCMake-a980418f7b46e5ec63e3bd7b3c0e71f5e2b5ffac.zip
CMake-a980418f7b46e5ec63e3bd7b3c0e71f5e2b5ffac.tar.gz
CMake-a980418f7b46e5ec63e3bd7b3c0e71f5e2b5ffac.tar.bz2
cmake --install: Fix concurrency level of parallel install
- Increment the number of currently working installs - Call uv_run only once
Diffstat (limited to 'Source/cmInstallScriptHandler.cxx')
-rw-r--r--Source/cmInstallScriptHandler.cxx20
1 files changed, 13 insertions, 7 deletions
diff --git a/Source/cmInstallScriptHandler.cxx b/Source/cmInstallScriptHandler.cxx
index 353deee..9a4e70f 100644
--- a/Source/cmInstallScriptHandler.cxx
+++ b/Source/cmInstallScriptHandler.cxx
@@ -80,17 +80,23 @@ int cmInstallScriptHandler::install(unsigned int j)
std::size_t installed = 0;
std::size_t i = 0;
- while (installed < scripts.size()) {
+ std::function<void()> queueScripts;
+ queueScripts = [&scripts, &working, &installed, &i, &loop, j,
+ &queueScripts]() {
for (auto queue = std::min(j - working, scripts.size() - i); queue > 0;
--queue) {
- scripts[i].start(loop, [&scripts, &working, &installed, i]() {
- scripts[i].printResult(++installed, scripts.size());
- --working;
- });
+ ++working;
+ scripts[i].start(loop,
+ [&scripts, &working, &installed, i, &queueScripts]() {
+ scripts[i].printResult(++installed, scripts.size());
+ --working;
+ queueScripts();
+ });
++i;
}
- uv_run(loop, UV_RUN_DEFAULT);
- }
+ };
+ queueScripts();
+ uv_run(loop, UV_RUN_DEFAULT);
// Write install manifest
std::string install_manifest;