--- ray/src/rt/raypcalls.c 2007/09/12 03:57:00 2.15 +++ ray/src/rt/raypcalls.c 2008/02/20 05:21:29 2.19 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: raypcalls.c,v 2.15 2007/09/12 03:57:00 greg Exp $"; +static const char RCSid[] = "$Id: raypcalls.c,v 2.19 2008/02/20 05:21:29 greg Exp $"; #endif /* * raypcalls.c - interface for parallel rendering using Radiance @@ -131,13 +131,11 @@ static const char RCSid[] = "$Id: raypcalls.c,v 2.15 2 * process should not be compromised. */ -#include -#include -#include /* XXX platform */ - #include "rtprocess.h" #include "ray.h" #include "ambient.h" +#include +#include #include "selcall.h" #ifndef RAYQLEN @@ -259,14 +257,14 @@ ray_pqueue( /* queue a ray for computation */ return(0); /* check for full send queue */ if (sendq_full()) { - RAY mySend; - int rval; - mySend = *r; + RAY mySend = *r; /* wait for a result */ - rval = ray_presult(r, 0); + if (ray_presult(r, 0) <= 0) + return(-1); /* put new ray in queue */ r_queue[r_send_next++] = mySend; - return(rval); /* done */ + /* XXX r_send_next may now be > RAYQLEN */ + return(1); } /* else add ray to send queue */ r_queue[r_send_next++] = *r; @@ -308,6 +306,9 @@ ray_presult( /* check for a completed ray */ n = ray_pnprocs - ray_pnidle; if (n <= 0) /* return if nothing to await */ return(0); + if (!poll && ray_pnprocs == 1) /* one process -> skip select() */ + FD_SET(r_proc[0].fd_recv, &readset); + getready: /* any children waiting for us? */ for (pn = ray_pnprocs; pn--; ) if (FD_ISSET(r_proc[pn].fd_recv, &readset) ||