Wait for child processes before getting new tasks from the list.

This commit is contained in:
Gunnar Beutner 2013-02-11 23:18:26 +01:00
parent c6e8013238
commit cf920cd0f2
1 changed files with 6 additions and 6 deletions

View File

@ -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)