Kernel: Semaphores and Threads can now be blocked with timeout

This commit is contained in:
2024-02-09 15:18:34 +02:00
parent 534b3e6a9a
commit ed0b1a86aa
17 changed files with 86 additions and 78 deletions

View File

@@ -92,7 +92,7 @@ namespace Kernel
while (true)
{
while (!TTY::current()->m_tty_ctrl.receive_input)
TTY::current()->m_tty_ctrl.semaphore.block();
TTY::current()->m_tty_ctrl.semaphore.block_indefinite();
Input::KeyEvent event;
size_t read = MUST(inode->read(0, BAN::ByteSpan::from(event)));
@@ -323,7 +323,7 @@ namespace Kernel
uint32_t depth = m_lock.lock_depth();
for (uint32_t i = 0; i < depth; i++)
m_lock.unlock();
auto eintr = Thread::current().block_or_eintr(m_output.semaphore);
auto eintr = Thread::current().block_or_eintr_indefinite(m_output.semaphore);
for (uint32_t i = 0; i < depth; i++)
m_lock.lock();
if (eintr.is_error())