--- ray/src/rt/rc3.c 2012/06/16 17:09:49 2.10 +++ ray/src/rt/rc3.c 2012/06/21 17:14:32 2.15 @@ -1,13 +1,13 @@ #ifndef lint -static const char RCSid[] = "$Id: rc3.c,v 2.10 2012/06/16 17:09:49 greg Exp $"; +static const char RCSid[] = "$Id: rc3.c,v 2.15 2012/06/21 17:14:32 greg Exp $"; #endif /* * Accumulate ray contributions for a set of materials * Controlling process for multiple children */ +#include #include "rcontrib.h" -#include "platform.h" #include "rtprocess.h" #include "selcall.h" @@ -315,13 +315,17 @@ in_rchild() /* Close child processes */ void -end_children() +end_children(int immed) { int status; while (nchild > 0) { nchild--; - if ((status = close_process(&kida[nchild].pr)) > 0) { +#ifdef SIGKILL + if (immed) /* error mode -- quick exit */ + kill(kida[nchild].pr.pid, SIGKILL); +#endif + if ((status = close_process(&kida[nchild].pr)) > 0 && !immed) { sprintf(errmsg, "rendering process returned bad status (%d)", status); @@ -462,7 +466,7 @@ static int next_child_ready() { fd_set writeset, errset; - int i, n, nqr; + int i, n; for (i = nchild; i--; ) /* see if there's one free first */ if (!kida[i].nr) @@ -537,13 +541,14 @@ feeder_loop() lastray += kida[i].nr = ninq; ninq = 0; } - for (i = nchild; i--; ) { /* get results */ - close(kida[i].pr.w); + memset(orgdir, 0, sizeof(FVECT)*2); /* get results */ + for (i = nchild; i--; ) { + writebuf(kida[i].pr.w, (char *)orgdir, sizeof(FVECT)*2); queue_results(i); } if (recover) /* and from before? */ queue_modifiers(); - end_children(); /* free up file descriptors */ + end_children(0); /* free up file descriptors */ for (i = 0; i < nmods; i++) mod_output(out_bq->mca[i]); /* output accumulated record */ end_record();