From cf920cd0f22a76633a5b44187599227afc9fcd18 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 11 Feb 2013 23:18:26 +0100 Subject: [PATCH] Wait for child processes before getting new tasks from the list. --- lib/base/process.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/base/process.cpp b/lib/base/process.cpp index b6b0d9d42..9315c017e 100644 --- a/lib/base/process.cpp +++ b/lib/base/process.cpp @@ -161,12 +161,6 @@ void Process::WorkerThreadProc(int taskFd) int idx = 0; - if (tasks.size() < MaxTasksPerThread) { - pfds[idx].fd = taskFd; - pfds[idx].events = POLLIN; - idx++; - } - int fd; BOOST_FOREACH(tie(fd, tuples::ignore), tasks) { pfds[idx].fd = fd; @@ -174,6 +168,12 @@ void Process::WorkerThreadProc(int taskFd) idx++; } + if (tasks.size() < MaxTasksPerThread) { + pfds[idx].fd = taskFd; + pfds[idx].events = POLLIN; + idx++; + } + int rc = poll(pfds, idx, -1); if (rc < 0 && errno != EINTR)