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

Comparing ray/src/rt/persist.c (file contents):
Revision 2.16 by greg, Mon Jul 8 19:46:21 1996 UTC vs.
Revision 2.17 by greg, Fri Jul 19 10:16:00 1996 UTC

# Line 138 | Line 138 | pfhold()               /* holding pattern for idle rendering proces
138          sprintf(buf, "%s %d\n%s\n%s\n%s\n", progname, getpid(),
139                          inpname, outpname, errname);
140          n = strlen(buf);
141 +        lseek(persistfd, 0L, 0);
142          if (write(persistfd, buf, n) < n)
143                  error(SYSTEM, "error writing persist file");
144                                  /* wait TIMELIM for someone to signal us */
# Line 148 | Line 149 | pfhold()               /* holding pattern for idle rendering proces
149          pflock(0);                      /* unlock persist file for attach */
150          while (!got_io)
151                  pause();                /* wait for attach */
151        pflock(1);                      /* grab persist file right back! */
152          alarm(0);                       /* turn off alarm */
153          signal(SIGALRM, oldalrm);
154          signal(SIGIO, SIG_DFL);
155 <        if (lseek(persistfd, 0L, 0) < 0 || ftruncate(persistfd, 0L) < 0)
156 <                error(SYSTEM, "seek/truncate error on persist file");
155 >        pflock(1);                      /* grab persist file back */
156                                  /* someone wants us; reopen stdin and stdout */
157          if (freopen(inpname, "r", stdin) == NULL)
158                  goto openerr;
# Line 186 | Line 185 | io_process()           /* just act as go-between for actual pro
185          int     fdin, fdout, fderr = -1;
186          fd_set  readfds, writefds, excepfds;
187                                          /* load persist file */
188 +        n = 40;
189          while ((nr = read(persistfd, buf, sizeof(buf)-1)) == 0) {
190 +                if (!n--)
191 +                        error(USER, "unattended persist file?");
192                  pflock(0);
193                  sleep(15);              /* wait until ready */
194                  pflock(1);
195          }
194        pfdetach();                     /* close persist file */
196          if (nr < 0)
197                  error(SYSTEM, "error reading persist file");
198 <        buf[nr] = '\0';
198 >        ftruncate(persistfd, 0L);       /* truncate persist file */
199 >        pfdetach();                     /* close & release persist file */
200 >        buf[nr] = '\0';                 /* parse what we got */
201          if ((cp = index(buf, ' ')) == NULL)
202                  goto formerr;
203          *cp++ = '\0';

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines