Install a SIGCHLD handler so select(2) will be interrupted when a child
terminates. Without this patch, 'make -j1 buildworld' takes about 30% longer than 'make -B buildworld' on my 2.4 GHz P4; the difference is probably even larger on faster systems. With this patch, there is no perceptible difference in wall time between the two. Submitted by: bde MFC after: 3 days
This commit is contained in:
parent
34759c3ef9
commit
87bbd0b031
@ -410,6 +410,10 @@ chdir_verify_path(char *path, char *obpath)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
catch_child(int sig)
|
||||
{
|
||||
}
|
||||
|
||||
/*-
|
||||
* main --
|
||||
@ -452,6 +456,22 @@ main(int argc, char **argv)
|
||||
/* avoid faults on read-only strings */
|
||||
static char syspath[] = _PATH_DEFSYSPATH;
|
||||
|
||||
{
|
||||
/*
|
||||
* Catch SIGCHLD so that we get kicked out of select() when we
|
||||
* need to look at a child. This is only known to matter for the
|
||||
* -j case (perhaps without -P).
|
||||
*
|
||||
* XXX this is intentionally misplaced.
|
||||
*/
|
||||
struct sigaction sa;
|
||||
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = SA_RESTART | SA_NOCLDSTOP;
|
||||
sa.sa_handler = catch_child;
|
||||
sigaction(SIGCHLD, &sa, NULL);
|
||||
}
|
||||
|
||||
#ifdef WANT_ENV_MKLVL
|
||||
if ((iMkLvl = szMkLvl ? atoi(szMkLvl) : 0) < 0) {
|
||||
iMkLvl = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user