From: Junio C Hamano Date: Fri, 02 Oct 2015 18:48:18 GMT Subject: Re: [PATCHv6 0/8] fetch submodules in parallel Message-ID: In-Reply-To: <1443664456-1307-1-git-send-email-sbeller@google.com> Stefan Beller writes: > * renamed return_value_fn to task_finished_fn It made interdiff noisier but I think it gives us a good end result. > * the main loop of the parallel processing was first adapted to Junios suggestion, > but Jonathan pointed out more improvements. We can get rid of `no_more_task` > completely as `if (!pp->nr_processes)` as the exit condition is sufficient. > (pp->nr_processes is modified only when starting or reaping a child, so we will > capture the whole output of each subprocess even in case of a quick shutdown) Interesting. The original motivation for "no-more-task" check was that even when we are no longer running anything (i.e. everybody finished) we may get a new task from next_task(), and the condition to "break" out of the loop could be placed anywhere in that loop (e.g. after we wait and cull the finished tasks, or even in the outermost while(1) condition). But you can take advantage of the specific placement of the check; it is after the part that spawns new tasks and before the part that culls the existing tasks, so not having any running task at that point is sufficient condition. Will replace what was queued. Thanks.