]> granicus.if.org Git - icinga2/commitdiff
Wait for child processes before getting new tasks from the list.
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 11 Feb 2013 22:18:26 +0000 (23:18 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 11 Feb 2013 22:18:26 +0000 (23:18 +0100)
lib/base/process.cpp

index b6b0d9d42d89ba5904393a520ffced26f83d7d50..9315c017ea3a0690b7e8d3d99a7e4818d01a6a5e 100644 (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)