From 49133dce48089b0610f5ba4fa410bf4df2fcea36 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 3 Dec 2024 21:54:27 +0200 Subject: [PATCH] Kernel: Make pipe check data every 100ms This prevents dead lock if read-end does not detect data before blocking why write-end already notified. --- kernel/kernel/FS/Pipe.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/kernel/FS/Pipe.cpp b/kernel/kernel/FS/Pipe.cpp index d12ece83..52de5b40 100644 --- a/kernel/kernel/FS/Pipe.cpp +++ b/kernel/kernel/FS/Pipe.cpp @@ -49,7 +49,7 @@ namespace Kernel if (m_writing_count == 0) return 0; LockFreeGuard lock_free(m_mutex); - TRY(Thread::current().block_or_eintr_indefinite(m_thread_blocker)); + TRY(Thread::current().block_or_eintr_or_timeout_ms(m_thread_blocker, 100, false)); } const size_t to_copy = BAN::Math::min(buffer.size(), m_buffer_size); @@ -84,7 +84,7 @@ namespace Kernel while (m_buffer.size() - m_buffer_size < buffer.size()) { LockFreeGuard lock_free(m_mutex); - TRY(Thread::current().block_or_eintr_indefinite(m_thread_blocker)); + TRY(Thread::current().block_or_eintr_or_timeout_ms(m_thread_blocker, 100, false)); } const size_t to_copy = buffer.size();