| 158 |
|
#endif |
| 159 |
|
#endif |
| 160 |
|
|
| 161 |
– |
extern char *shm_boundary; /* boundary of shared memory */ |
| 162 |
– |
|
| 161 |
|
int ray_pnprocs = 0; /* number of child processes */ |
| 162 |
|
int ray_pnidle = 0; /* number of idle children */ |
| 163 |
|
|
| 215 |
|
continue; |
| 216 |
|
/* smuggle set size in crtype */ |
| 217 |
|
r_queue[sfirst].crtype = n; |
| 218 |
< |
nw = writebuf(r_proc[i].fd_send, (char *)&r_queue[sfirst], |
| 218 |
> |
nw = writebuf(r_proc[i].fd_send, &r_queue[sfirst], |
| 219 |
|
sizeof(RAY)*n); |
| 220 |
|
if (nw != sizeof(RAY)*n) |
| 221 |
|
return(-1); /* write error */ |
| 346 |
|
error(CONSISTENCY, "buffer shortage in ray_presult()"); |
| 347 |
|
|
| 348 |
|
/* read rendered ray data */ |
| 349 |
< |
n = readbuf(r_proc[pn].fd_recv, (char *)&r_queue[r_recv_next], |
| 349 |
> |
n = readbuf(r_proc[pn].fd_recv, &r_queue[r_recv_next], |
| 350 |
|
sizeof(RAY)*r_proc[pn].npending); |
| 351 |
|
if (n > 0) { |
| 352 |
|
r_recv_next += n/sizeof(RAY); |
| 386 |
|
{ |
| 387 |
|
ray_pclose(0); /* close child processes */ |
| 388 |
|
|
| 389 |
< |
if (shm_boundary != NULL) { /* clear shared memory boundary */ |
| 392 |
< |
free((void *)shm_boundary); |
| 393 |
< |
shm_boundary = NULL; |
| 394 |
< |
} |
| 389 |
> |
cow_doneshare(); /* clear shared memory boundary */ |
| 390 |
|
|
| 391 |
|
ray_done(freall); /* free rendering data */ |
| 392 |
|
} |
| 430 |
|
rayvalue(&r_queue[i]); |
| 431 |
|
} |
| 432 |
|
/* write back our results */ |
| 433 |
< |
i = writebuf(fd_out, (char *)r_queue, sizeof(RAY)*n); |
| 433 |
> |
i = writebuf(fd_out, r_queue, sizeof(RAY)*n); |
| 434 |
|
if (i != sizeof(RAY)*n) |
| 435 |
|
error(SYSTEM, "write error in ray_pchild()"); |
| 436 |
|
} |
| 454 |
|
if (nobjects <= 0) |
| 455 |
|
error(CONSISTENCY, "ray_popen() called before scene loaded"); |
| 456 |
|
ambsync(); /* load any new ambient values */ |
| 457 |
< |
if (shm_boundary == NULL) { /* first child process? */ |
| 463 |
< |
preload_objs(); /* preload auxiliary data */ |
| 464 |
< |
/* set shared memory boundary */ |
| 465 |
< |
shm_boundary = (char *)malloc(16); |
| 466 |
< |
strcpy(shm_boundary, "SHM_BOUNDARY"); |
| 467 |
< |
} |
| 457 |
> |
cow_memshare(); /* copy-on-write shared memory */ |
| 458 |
|
fflush(NULL); /* clear pending output */ |
| 459 |
|
samplestep = ray_pnprocs + nadd; |
| 460 |
|
while (nadd--) { /* fork each new process */ |