ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rc3.c
(Generate patch)

Comparing ray/src/rt/rc3.c (file contents):
Revision 2.10 by greg, Sat Jun 16 17:09:49 2012 UTC vs.
Revision 2.15 by greg, Thu Jun 21 17:14:32 2012 UTC

# Line 6 | Line 6 | static const char RCSid[] = "$Id$";
6   * Controlling process for multiple children
7   */
8  
9 + #include <signal.h>
10   #include "rcontrib.h"
10 #include "platform.h"
11   #include "rtprocess.h"
12   #include "selcall.h"
13  
# Line 315 | Line 315 | in_rchild()
315  
316   /* Close child processes */
317   void
318 < end_children()
318 > end_children(int immed)
319   {
320          int     status;
321          
322          while (nchild > 0) {
323                  nchild--;
324 <                if ((status = close_process(&kida[nchild].pr)) > 0) {
324 > #ifdef SIGKILL
325 >                if (immed)              /* error mode -- quick exit */
326 >                        kill(kida[nchild].pr.pid, SIGKILL);
327 > #endif
328 >                if ((status = close_process(&kida[nchild].pr)) > 0 && !immed) {
329                          sprintf(errmsg,
330                                  "rendering process returned bad status (%d)",
331                                          status);
# Line 462 | Line 466 | static int
466   next_child_ready()
467   {
468          fd_set                  writeset, errset;
469 <        int                     i, n, nqr;
469 >        int                     i, n;
470  
471          for (i = nchild; i--; )         /* see if there's one free first */
472                  if (!kida[i].nr)
# Line 537 | Line 541 | feeder_loop()
541                  lastray += kida[i].nr = ninq;
542                  ninq = 0;
543          }
544 <        for (i = nchild; i--; ) {               /* get results */
545 <                close(kida[i].pr.w);
544 >        memset(orgdir, 0, sizeof(FVECT)*2);     /* get results */
545 >        for (i = nchild; i--; ) {
546 >                writebuf(kida[i].pr.w, (char *)orgdir, sizeof(FVECT)*2);
547                  queue_results(i);
548          }
549          if (recover)                            /* and from before? */
550                  queue_modifiers();
551 <        end_children();                         /* free up file descriptors */
551 >        end_children(0);                        /* free up file descriptors */
552          for (i = 0; i < nmods; i++)
553                  mod_output(out_bq->mca[i]);     /* output accumulated record */
554          end_record();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines