mirror of
https://github.com/mirror/make.git
synced 2024-12-29 14:30:42 +08:00
Don't block for child exit if other commands have completed
Running regression tests on a single CPU system shows that if a child exits while we're checking prerequisites we might not notice it, and then we might block waiting for the next child to exit before we try to do more work even though we could. * src/remake.c (update_goal_chain): Remember the command_count before we start checking prerequisites and if it is different when we restart at the top of the goal chain then don't block.
This commit is contained in:
parent
2449ef3c88
commit
4c9b922560
@ -109,6 +109,7 @@ check_also_make (const struct file *file)
|
|||||||
enum update_status
|
enum update_status
|
||||||
update_goal_chain (struct goaldep *goaldeps)
|
update_goal_chain (struct goaldep *goaldeps)
|
||||||
{
|
{
|
||||||
|
unsigned long last_cmd_count = 0;
|
||||||
int t = touch_flag, q = question_flag, n = just_print_flag;
|
int t = touch_flag, q = question_flag, n = just_print_flag;
|
||||||
enum update_status status = us_none;
|
enum update_status status = us_none;
|
||||||
|
|
||||||
@ -134,9 +135,12 @@ update_goal_chain (struct goaldep *goaldeps)
|
|||||||
|
|
||||||
start_waiting_jobs ();
|
start_waiting_jobs ();
|
||||||
|
|
||||||
/* Wait for a child to die. */
|
/* Check for exited children. If no children have finished since the
|
||||||
|
last time we looked, then block until one exits. If some have
|
||||||
|
exited don't block, so we can possibly do more work. */
|
||||||
|
|
||||||
reap_children (1, 0);
|
reap_children (last_cmd_count == command_count, 0);
|
||||||
|
last_cmd_count = command_count;
|
||||||
|
|
||||||
lastgoal = 0;
|
lastgoal = 0;
|
||||||
gu = goals;
|
gu = goals;
|
||||||
|
Loading…
Reference in New Issue
Block a user