2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00

Add macros to gcc.hpp to support pathscale toolset.

Added an optimization to the -lx unix timeout code.  I
compute the amount of time the select call should sleep
until the "oldest" process times out.  This ensures that
all processes that timeout will be killed within one
second of their expiration.



[SVN r39534]
This commit is contained in:
K. Noel Belcourt
2007-09-25 23:11:12 +00:00
parent 8ec23781c2
commit 733b716783

View File

@@ -62,6 +62,7 @@
static clock_t tps = 0;
static struct timeval tv;
static int timeout = 0;
static int intr = 0;
static int cmdsrunning = 0;
@@ -355,6 +356,9 @@ void close_streams(int i, int s)
void populate_file_descriptors(int *fmax, fd_set *fds)
{
int i, fd_max = 0;
struct tms buf;
clock_t current = times(&buf);
timeout = globs.timeout;
/* compute max read file descriptor for use in select */
FD_ZERO(fds);
@@ -375,9 +379,9 @@ void populate_file_descriptors(int *fmax, fd_set *fds)
}
if (globs.timeout && cmdtab[i].pid) {
struct tms buf;
clock_t current = times(&buf);
if (globs.timeout <= (current-cmdtab[i].start_time)/tps) {
clock_t consumed = (current - cmdtab[i].start_time) / tps;
timeout = (globs.timeout - consumed) < timeout ? (globs.timeout - consumed) : timeout;
if (globs.timeout <= consumed) {
killpg(cmdtab[i].pid, SIGKILL);
cmdtab[i].exit_reason = EXIT_TIMEOUT;
}
@@ -414,7 +418,7 @@ execwait()
if (0 < globs.timeout) {
/* force select to timeout so we can terminate expired processes */
tv.tv_sec = globs.timeout;
tv.tv_sec = timeout;
tv.tv_usec = 0;
/* select will wait until: io on a descriptor, a signal, or we time out */