ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/ambient.c
(Generate patch)

Comparing ray/src/rt/ambient.c (file contents):
Revision 2.62 by greg, Mon Aug 22 16:07:26 2005 UTC vs.
Revision 2.63 by greg, Thu Sep 13 20:13:16 2007 UTC

# Line 192 | Line 192 | setambient(void)                               /* initialize calculation */
192                  sprintf(errmsg, "cannot open ambient file \"%s\"", ambfile);
193                  error(SYSTEM, errmsg);
194          }
195 <        nunflshed++;    /* lie */
196 <        ambsync();
195 >        ambsync();                      /* load previous values */
196   }
197  
198  
# Line 877 | Line 876 | ambsync(void)                  /* synchronize ambient file */
876          AMBVAL  avs;
877          register int  n;
878  
880        if (nunflshed == 0)
881                return(0);
879          if (lastpos < 0)        /* initializing (locked in initambfile) */
880                  goto syncend;
881 <                                /* gain exclusive access */
882 <        aflock(F_WRLCK);
881 >                                /* gain appropriate access */
882 >        aflock(nunflshed ? F_WRLCK : F_RDLCK);
883                                  /* see if file has grown */
884          if ((flen = lseek(fileno(ambfp), (off_t)0, SEEK_END)) < 0)
885                  goto seekerr;
# Line 935 | Line 932 | seekerr:
932   extern int
933   ambsync(void)                   /* flush ambient file */
934   {
938        if (nunflshed == 0)
939                return(0);
935          nunflshed = 0;
936          return(fflush(ambfp));
937   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines