Ticket #1476: pipefs.diff

File pipefs.diff, 485 bytes (added by jackburton, 17 years ago)
  • pipefs.cpp

     
    832832        }
    833833    }
    834834
    835     if ((openMode & O_ACCMODE) == O_RDONLY || (openMode & O_ACCMODE) == O_RDWR)
    836         atomic_add(&fReaderCount, -1);
     835    if ((openMode & O_ACCMODE) == O_RDONLY || (openMode & O_ACCMODE) == O_RDWR) {
     836        if (atomic_add(&fReaderCount, -1) == 1) {
     837            delete_sem(fWriteLock);
     838            fWriteLock = -1;       
     839        }
     840    }
    837841}
    838842
    839843