* Made sure that at least the common case with a single writer exits write()

once the file descriptor is closed.
* Reinstantiated the FIFO functionality as long there are no writers yet as
  explained by Ingo.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37883 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-08-03 19:27:52 +00:00
parent 80ac9aef07
commit dac5d7fe4f

View File

@ -458,7 +458,7 @@ Inode::ReadDataFromBuffer(void* data, size_t* _length, bool nonBlocking,
if (nonBlocking)
return B_WOULD_BLOCK;
if (fWriterCount == 0)
if (fActive && fWriterCount == 0)
return B_OK;
TRACE("Inode %p::%s(): wait for data, request %p\n", this, __FUNCTION__,
@ -653,6 +653,13 @@ Inode::Close(int openMode, file_cookie* cookie)
NotifyEndClosed(false);
}
if (fWriterCount == 0) {
// Notify any still reading writers to stop
// TODO: This only works reliable if there is only one writer - we could
// do the same thing done for the read requests.
fWriteCondition.NotifyAll(B_FILE_ERROR);
}
if (fReaderCount == 0 && fWriterCount == 0) {
fActive = false;
fBuffer.DeleteBuffer();