diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2020-01-04 16:16:38 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2020-01-04 16:16:38 +0000 |
commit | b729f05495f7d1334985d643bfdb5030fd44817b (patch) | |
tree | a270c8729459c49b37e0e64e86a3810f767686ab /usr.bin | |
parent | 708061cc6edaffdeb981997ad0be918b39304595 (diff) |
create a separate function "may_continue_heldback_jobs" and invoke
it in the main reaper loop, instead of waiting for a job with an
expensive command to exit.
This prevents jobs with an expensive command from holding back everything
else until their full list of commands is run, instead of just the
expensive one.
(as JOB_IS_EXPENSIVE is updated before and after each command for a job,
this is safe)
This might make things slightly more parallel. It's definitely more correct
and less tangled.
okay millert@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/make/job.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index 60c5d5a5ab9..c248e7ff421 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -1,4 +1,4 @@ -/* $OpenBSD: job.c,v 1.145 2020/01/04 12:50:52 espie Exp $ */ +/* $OpenBSD: job.c,v 1.146 2020/01/04 16:16:37 espie Exp $ */ /* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */ /* @@ -148,6 +148,7 @@ static void may_continue_job(Job *); static void continue_job(Job *); static Job *reap_finished_job(pid_t); static bool reap_jobs(void); +static void may_continue_heldback_jobs(); static void loop_handle_running_jobs(void); static bool expensive_job(Job *); @@ -746,9 +747,14 @@ remove_job(Job *job) { nJobs--; postprocess_job(job); +} + +static void +may_continue_heldback_jobs() +{ while (!no_new_jobs) { if (heldJobs != NULL) { - job = heldJobs; + Job *job = heldJobs; heldJobs = heldJobs->next; if (DEBUG(EXPENSIVE)) fprintf(stderr, "[%ld] cheap -> release %s\n", @@ -803,6 +809,7 @@ reap_jobs(void) job_handle_status(job, status); determine_job_next_step(job); } + may_continue_heldback_jobs(); } /* sanity check, should not happen */ if (pid == -1 && errno == ECHILD && runningJobs != NULL) |