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.5 by greg, Mon Jan 25 19:17:36 1993 UTC

# Line 14 | Line 14 | static char SCCSid[] = "$SunId$ LBL";
14   #include <sys/types.h>
15   #include <sys/stat.h>
16  
17 + #ifndef TIMELIM
18 + #define TIMELIM         (8*3600)        /* time limit for holding pattern */
19 + #endif
20 +
21   extern char     *strcpy(), *index();
22  
23   extern int      headismine;     /* boolean true if header belongs to me */
# Line 83 | Line 87 | char   *pfn;
87   }
88  
89  
90 < sig_noop() {}
90 > int sig_noop() {}
91  
92  
93   pfhold()                /* holding pattern for idle rendering process */
# Line 92 | Line 96 | pfhold()               /* holding pattern for idle rendering proces
96          register int    n;
97                                  /* close input and output descriptors */
98          close(fileno(stdin));
95        fflush(stdout);
99          close(fileno(stdout));
100                                  /* create named pipes for input and output */
101          if (mknod(mktemp(strcpy(inpname,TEMPLATE)), S_IFIFO|0600) < 0)
# Line 105 | Line 108 | pfhold()               /* holding pattern for idle rendering proces
108          n = strlen(buf);
109          if (write(persistfd, buf, n) < n)
110                  error(SYSTEM, "error writing persist file in pfhold");
111 <                                /* wait for someone to signal us */
112 <        signal(SIGALRM, sig_noop);
111 >                                /* wait TIMELIM for someone to signal us */
112 >        signal(SIGIO, sig_noop);
113 >        alarm(TIMELIM);
114          pflock(0);
115          pause();
116 +        alarm(0);
117 +        signal(SIGIO, SIG_DFL);
118          pflock(1);
119                                  /* someone wants us; reopen stdin and stdout */
120          if (freopen(inpname, "r", stdin) == NULL)
# Line 155 | Line 161 | io_process()           /* just act as conduits to and from actu
161          if (cp-buf != nr)
162                  goto formerr;
163                                  /* wake up rendering process */
164 <        if (kill(pid, SIGALRM) < 0)
164 >        if (kill(pid, SIGIO) < 0)
165                  error(SYSTEM, "cannot signal rendering process in io_process");
166          pid = fork();           /* fork i/o process */
167          if (pid < 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines