From ee0274907014da44773c7646bb768252fb27e195 Mon Sep 17 00:00:00 2001
From: Philippe Houdoin <philippe.houdoin@gmail.com>
Date: Wed, 26 Jul 2017 18:15:11 +0000
Subject: [PATCH] fifo: fix #7859
---
src/system/kernel/fs/fifo.cpp | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/system/kernel/fs/fifo.cpp b/src/system/kernel/fs/fifo.cpp
index e7e9f2c2e1..65c1b0203f 100644
a
|
b
|
Inode::NotifyEndClosed(bool writer)
|
615 | 615 | request->Notify(); |
616 | 616 | |
617 | 617 | if (fReadSelectSyncPool) |
618 | | notify_select_event_pool(fReadSelectSyncPool, B_SELECT_READ); |
| 618 | notify_select_event_pool(fReadSelectSyncPool, B_SELECT_DISCONNECTED); |
619 | 619 | } |
620 | 620 | } else { |
621 | 621 | // Last reader is gone. Wake up all writers. |
… |
… |
Inode::NotifyEndClosed(bool writer)
|
623 | 623 | |
624 | 624 | if (fWriteSelectSyncPool) { |
625 | 625 | notify_select_event_pool(fWriteSelectSyncPool, B_SELECT_WRITE); |
626 | | notify_select_event_pool(fWriteSelectSyncPool, B_SELECT_ERROR); |
| 626 | notify_select_event_pool(fWriteSelectSyncPool, B_SELECT_DISCONNECTED); |
627 | 627 | } |
628 | 628 | } |
629 | 629 | } |
… |
… |
Inode::Select(uint8 event, selectsync* sync, int openMode)
|
710 | 710 | |
711 | 711 | // signal right away, if the condition holds already |
712 | 712 | if (writer) { |
713 | | if ((event == B_SELECT_WRITE |
714 | | && (fBuffer.Writable() > 0 || fReaderCount == 0)) |
715 | | || (event == B_SELECT_ERROR && fReaderCount == 0)) { |
| 713 | if (event == B_SELECT_WRITE && fBuffer.Writable() > 0) |
716 | 714 | return notify_select_event(sync, event); |
717 | | } |
| 715 | if (fReaderCount == 0) |
| 716 | return notify_select_event(sync, B_SELECT_DISCONNECTED); |
718 | 717 | } else { |
719 | | if (event == B_SELECT_READ |
720 | | && (fBuffer.Readable() > 0 || fWriterCount == 0)) { |
| 718 | if (event == B_SELECT_READ && fBuffer.Readable() > 0) |
721 | 719 | return notify_select_event(sync, event); |
722 | | } |
| 720 | if (fWriterCount == 0) |
| 721 | return notify_select_event(sync, B_SELECT_DISCONNECTED); |
723 | 722 | } |
724 | 723 | |
725 | 724 | return B_OK; |