diff options
author | phk <phk@FreeBSD.org> | 2004-11-12 08:58:07 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-11-12 08:58:07 +0000 |
commit | eb0fa827fcfd13a6fb449fdc5fe1a3c114b2f0a0 (patch) | |
tree | 8b295cb4fe4d748e59a9ca3dbb4896739065fcbd /usr.bin/make/make.c | |
parent | 24fe3160f6855d1e448487cea73895c8f79a7edd (diff) | |
download | FreeBSD-src-eb0fa827fcfd13a6fb449fdc5fe1a3c114b2f0a0.zip FreeBSD-src-eb0fa827fcfd13a6fb449fdc5fe1a3c114b2f0a0.tar.gz |
Add code to enforce the paralleism count (-j N) for the entire tree
of submakes spawned during processing.
We create a fifo and stuff one character into it for each job we are
allowed to run. The name of the fifo is passed to child processes
in the MAKE_JOBS_FIFO environment variable.
A make which finds this variable on startup will open the fifo and
only spawn jobs when it managed to read a token from the fifo.
When the job completes a token is writen back to the fifo.
Slave make processes get one token for free: the one their parent
make got in order to run them. This makes the make processes
themselves invisible in the process counts.
The net effect is that "make -j 12 -s buildworld" will start at
most 12 jobs at the same time, instead of as previously up to
65 jobs would get started.
Diffstat (limited to 'usr.bin/make/make.c')
-rw-r--r-- | usr.bin/make/make.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c index 762b65a..4f85b68 100644 --- a/usr.bin/make/make.c +++ b/usr.bin/make/make.c @@ -637,7 +637,7 @@ MakeStartJobs (void) { GNode *gn; - while (!Job_Full() && !Lst_IsEmpty (toBeMade)) { + while (!Lst_IsEmpty (toBeMade) && !Job_Full()) { gn = (GNode *) Lst_DeQueue (toBeMade); DEBUGF(MAKE, ("Examining %s...", gn->name)); /* @@ -840,7 +840,7 @@ Make_Run (Lst targs) * keepgoing flag was given. */ while (!Job_Empty ()) { - Job_CatchOutput (); + Job_CatchOutput (!Lst_IsEmpty (toBeMade)); Job_CatchChildren (!usePipes); (void)MakeStartJobs(); } |