Changeset 1697 for zzuf


Ignore:
Timestamp:
Jan 18, 2007, 7:45:58 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Minor improvement in the locking mechanism.
Location:
zzuf/trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/fd.c

    r1695 r1697  
    6161/* Create lock. This lock variable is used to disable file descriptor
    6262 * creation wrappers. For instance on Mac OS X, fopen() calls open()
    63  * and we don’t want open() to do any zzuf-related stuff. */
    64 static int create_lock;
     63 * and we don’t want open() to do any zzuf-related stuff, fopen() takes
     64 * care of everything. */
     65static int create_lock = 0;
    6566
    6667static int32_t seed = DEFAULT_SEED;
     
    276277
    277278    if(fd == -1)
    278         create_lock = 1;
     279        create_lock++;
    279280    else
    280         files[fds[fd]].locked = 1;
     281        files[fds[fd]].locked++;
    281282}
    282283
     
    287288
    288289    if(fd == -1)
    289         create_lock = 0;
     290        create_lock--;
    290291    else
    291         files[fds[fd]].locked = 0;
     292        files[fds[fd]].locked--;
    292293}
    293294
  • zzuf/trunk/src/lib-stream.c

    r1695 r1697  
    555555        return __srefill_orig(fp);
    556556
    557     tmp = _zz_islocked(fd);
    558557    _zz_lock(fd);
    559558    ret = __srefill_orig(fp);
    560559    newpos = lseek(fd, 0, SEEK_CUR);
    561     if(!tmp)
    562         _zz_unlock(fd);
     560    _zz_unlock(fd);
    563561    if(ret != EOF)
    564562    {
Note: See TracChangeset for help on using the changeset viewer.