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.1 by greg, Wed Jan 20 15:19:00 1993 UTC vs.
Revision 2.6 by greg, Fri Jan 29 12:02:29 1993 UTC

# Line 9 | Line 9 | static char SCCSid[] = "$SunId$ LBL";
9   */
10  
11   #include "standard.h"
12 +
13 + #ifdef F_SETLKW
14 +
15   #include "paths.h"
16   #include <signal.h>
17   #include <sys/types.h>
18   #include <sys/stat.h>
19  
20 + #ifndef TIMELIM
21 + #define TIMELIM         (8*3600)        /* time limit for holding pattern */
22 + #endif
23 +
24   extern char     *strcpy(), *index();
25  
26   extern int      headismine;     /* boolean true if header belongs to me */
# Line 83 | Line 90 | char   *pfn;
90   }
91  
92  
93 < sig_noop() {}
93 > int sig_noop() {}
94  
95  
96   pfhold()                /* holding pattern for idle rendering process */
# Line 92 | Line 99 | pfhold()               /* holding pattern for idle rendering proces
99          register int    n;
100                                  /* close input and output descriptors */
101          close(fileno(stdin));
95        fflush(stdout);
102          close(fileno(stdout));
103                                  /* create named pipes for input and output */
104          if (mknod(mktemp(strcpy(inpname,TEMPLATE)), S_IFIFO|0600) < 0)
# Line 105 | Line 111 | pfhold()               /* holding pattern for idle rendering proces
111          n = strlen(buf);
112          if (write(persistfd, buf, n) < n)
113                  error(SYSTEM, "error writing persist file in pfhold");
114 <                                /* wait for someone to signal us */
115 <        signal(SIGALRM, sig_noop);
114 >                                /* wait TIMELIM for someone to signal us */
115 >        signal(SIGIO, sig_noop);
116 >        alarm(TIMELIM);
117          pflock(0);
118          pause();
119 +        alarm(0);
120 +        signal(SIGIO, SIG_DFL);
121          pflock(1);
122                                  /* someone wants us; reopen stdin and stdout */
123          if (freopen(inpname, "r", stdin) == NULL)
# Line 155 | Line 164 | io_process()           /* just act as conduits to and from actu
164          if (cp-buf != nr)
165                  goto formerr;
166                                  /* wake up rendering process */
167 <        if (kill(pid, SIGALRM) < 0)
167 >        if (kill(pid, SIGIO) < 0)
168                  error(SYSTEM, "cannot signal rendering process in io_process");
169          pid = fork();           /* fork i/o process */
170          if (pid < 0)
# Line 187 | Line 196 | io_process()           /* just act as conduits to and from actu
196   formerr:
197          error(USER, "format error in persist file");
198   }
199 +
200 + #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines