Module Name: src
Committed By: sjg
Date: Sat May 12 18:17:04 UTC 2018
Modified Files:
src/usr.bin/make: job.c
Log Message:
Skip setting wantToken.
polling the job token pipe adds a lot of overhead
for little gain.
For now, just leave wantToken=0
And avoid busy waiting when no tokens are available and
no jobs are running.
Reviewed by: christos
To generate a diff of this commit:
cvs rdiff -u -r1.192 -r1.193 src/usr.bin/make/job.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.192 src/usr.bin/make/job.c:1.193
--- src/usr.bin/make/job.c:1.192 Thu Feb 8 09:05:21 2018
+++ src/usr.bin/make/job.c Sat May 12 18:17:04 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.192 2018/02/08 09:05:21 dholland Exp $ */
+/* $NetBSD: job.c,v 1.193 2018/05/12 18:17:04 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.192 2018/02/08 09:05:21 dholland Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.193 2018/05/12 18:17:04 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: job.c,v 1.192 2018/02/08 09:05:21 dholland Exp $");
+__RCSID("$NetBSD: job.c,v 1.193 2018/05/12 18:17:04 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -2944,14 +2944,15 @@ Job_TokenWithdraw(void)
count = read(tokenWaitJob.inPipe, &tok, 1);
if (count == 0)
Fatal("eof on job pipe!");
- if (count < 0 && jobTokensRunning != 0) {
+ if (count < 0) {
if (errno != EAGAIN) {
Fatal("job pipe read: %s", strerror(errno));
}
if (DEBUG(JOB))
fprintf(debug_file, "(%d) blocked for token\n", getpid());
- wantToken = 1;
- return FALSE;
+ if (jobTokensRunning)
+ return FALSE;
+ sleep(1); /* avoid busy wait */
}
if (count == 1 && tok != '+') {