ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/Development/ray/src/util/pvsum.c
(Generate patch)

Comparing ray/src/util/pvsum.c (file contents):
Revision 2.9 by greg, Wed Oct 29 02:48:50 2025 UTC vs.
Revision 2.10 by greg, Thu Oct 30 02:48:54 2025 UTC

# Line 507 | Line 507 | multi_process(void)
507                  fprintf(stderr, "%s: code Error 1 in multi_process()\n", gargv[0]);
508                  return(0);
509          }
510 <        while (--coff > 0) {            /* parent births children */
510 >        fflush(NULL);                   /* parent births helper subprocs */
511 >        while (--coff > 0) {
512                  int     pid = fork();
513                  if (pid < 0) {
514                          fprintf(stderr, "%s: fork() call failed!\n", gargv[0]);
515                          return(0);
516                  }
517 <                if (pid == 0) break;    /* child gets to work */
517 >                if (!pid) break;        /* new child gets to work */
518          }
519          if (!row0 | (out_type != DTfloat)) {
520                  osum = (float *)calloc((size_t)xres*yres, sizeof(float)*ncomp);
# Line 639 | Line 640 | multi_process(void)
640                          goto writerr;
641                  odd = !odd;             /* go back & forth to milk page cache */
642          }
643 +        if (coff) _exit(0);             /* child exits here */
644 +                                        /* but parent waits for children */
645          if (osum) free(osum);
646          free(syarr);
647 <        if (coff)                       /* child exits here... */
645 <                _exit(0);
646 <        c = 0;                          /* ...but parent waits for children */
647 >        c = 0;
648          while (++coff < nprocs) {
649                  int     st;
650                  if (wait(&st) < 0) {

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)