while (num_running < lbalance_target(lb)) {
int p[2];
- c = tlist_top(&pending, struct command, list);
+
+ c = tlist_top(&pending, list);
if (!c)
break;
+ fflush(stdout);
if (pipe(p) != 0)
err(1, "Pipe failed");
c->pid = fork();
signal(SIGALRM, killme);
itim.it_interval.tv_sec = itim.it_interval.tv_usec = 0;
- itim.it_value = time_from_msec(c->time_ms);
+ itim.it_value = timespec_to_timeval(time_from_msec(c->time_ms));
setitimer(ITIMER_REAL, &itim, NULL);
c->status = system(c->command);
struct command *c;
const void *ctx;
- while ((c = tlist_top(&done, struct command, list)) == NULL) {
+ while ((c = tlist_top(&done, list)) == NULL) {
if (tlist_empty(&pending) && tlist_empty(&running))
return NULL;
reap_output();