Skip to content

Commit

Permalink
Slightly improved flushing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregungory committed Mar 1, 2020
1 parent d1269a3 commit ad197a8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/rt/rtrace.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: rtrace.c,v 2.84 2019/08/14 22:33:02 greg Exp $";
static const char RCSid[] = "$Id: rtrace.c,v 2.85 2020/03/01 05:38:22 greg Exp $";
#endif
/*
* rtrace.c - program and variables for individual ray tracing.
Expand Down Expand Up @@ -117,7 +117,7 @@ rtrace( /* trace rays from file */
{
unsigned long vcount = (hresolu > 1) ? (unsigned long)hresolu*vresolu
: (unsigned long)vresolu;
long nextflush = (vresolu > 0) & (hresolu > 1) ? 0 : hresolu;
long nextflush = (!vresolu | (hresolu <= 1)) * hresolu;
int something2flush = 0;
FILE *fp;
double d;
Expand Down Expand Up @@ -168,14 +168,13 @@ rtrace( /* trace rays from file */

d = normalize(direc);
if (d == 0.0) { /* zero ==> flush */
if ((--nextflush <= 0) | !vcount && something2flush) {
if (something2flush) {
if (ray_pnprocs > 1 && ray_fifo_flush() < 0)
error(USER, "child(ren) died");
bogusray();
fflush(stdout);
something2flush = 0;
nextflush = (vresolu > 0) & (hresolu > 1) ? 0 :
hresolu;
nextflush = (!vresolu | (hresolu <= 1)) * hresolu;
} else
bogusray();
} else { /* compute and print */
Expand Down

0 comments on commit ad197a8

Please sign in to comment.