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

Comparing ray/src/util/rad.c (file contents):
Revision 2.97 by greg, Fri May 28 17:29:14 2010 UTC vs.
Revision 2.98 by greg, Sun Sep 12 18:42:40 2010 UTC

# Line 165 | Line 165 | static int touch(char  *fn);
165   static int runcom(char  *cs);
166   static int rmfile(char  *fn);
167   static int mvfile(char  *fold, char     *fnew);
168 < static int next_process(void);
168 > static int next_process(int     reserve);
169   static void wait_process(int    all);
170   static void finish_process(void);
171   static void badvalue(int        vc);
# Line 1371 | Line 1371 | rpict(                         /* run rpict and pfilt for each view */
1371                                  fprintf(fp, "%d %d\n", xdiv, ydiv);
1372                                  fclose(fp);
1373                          }
1374 <                } else if (next_process()) {
1374 >                } else if (next_process(0)) {
1375                          if (pfile != NULL)
1376                                  sleep(10);
1377                          continue;
# Line 1384 | Line 1384 | rpict(                         /* run rpict and pfilt for each view */
1384                                  sprintf(combuf, "%s -R %s %s%s %s %s%s%s -o %s %s",
1385                                                  c_rpiece, sfile, rppopt, rep, vw,
1386                                                  res, opts, po, rawfile, oct1name);
1387 <                                while (children_running < nprocs-1 &&
1388 <                                                        next_process()) {
1387 >                                while (next_process(1)) {
1388                                          sleep(10);
1389                                          combuf[strlen(c_rpiece)+2] = 'F';
1390                                  }
# Line 1401 | Line 1400 | rpict(                         /* run rpict and pfilt for each view */
1400                                                  c_rpict, rep, vw, opts,
1401                                                  oct1name, overfile);
1402                                  if (do_rpiece)
1403 <                                        while (children_running < nprocs-1 &&
1405 <                                                        next_process())
1403 >                                        while (next_process(1))
1404                                                  sleep(5);
1405                                  if (runcom(combuf)) {
1406                                          fprintf(stderr,
# Line 1422 | Line 1420 | rpict(                         /* run rpict and pfilt for each view */
1420                                  sprintf(combuf, "%s -F %s %s%s %s %s%s%s -o %s %s",
1421                                                  c_rpiece, sfile, rppopt, rep, vw,
1422                                                  res, opts, po, rawfile, oct1name);
1423 <                                while (children_running < nprocs-1 &&
1426 <                                                        next_process())
1423 >                                while (next_process(1))
1424                                          sleep(10);
1425                          } else {
1426                                  sprintf(combuf, "%s%s %s %s%s%s%s %s > %s",
# Line 1554 | Line 1551 | mvfile(                /* move a file */
1551  
1552   #ifdef RHAS_FORK_EXEC
1553   static int
1554 < next_process(void)                      /* fork the next process (max. nprocs) */
1554 > next_process(int reserve)               /* fork the next process */
1555   {
1556          RT_PID  child_pid;
1557  
# Line 1565 | Line 1562 | next_process(void)                     /* fork the next process (max. np
1562                                  progname);
1563                  quit(1);
1564          }
1565 +        if (reserve > 0 && children_running >= nprocs-reserve)
1566 +                return(0);              /* caller holding back process(es) */
1567          if (children_running >= nprocs)
1568                  wait_process(0);        /* wait for someone to finish */
1569          fflush(NULL);                   /* flush output */
# Line 1612 | Line 1611 | wait_process(                  /* wait for process(es) to finish */
1611   }
1612   #else   /* ! RHAS_FORK_EXEC */
1613   static int
1614 < next_process(void)
1614 > next_process(int reserve)
1615   {
1616          return(0);                      /* cannot start new process */
1617   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines