mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 23:25:20 +00:00
Implement a basic way for read() to block.
FileHandle gets a hasDataAvailableForRead() getter. If this returns true in sys$read(), the task will block(BlockedRead) + yield. The fd blocked on is stored in Task::m_fdBlockedOnRead. The scheduler then looks at the state of that fd during the unblock phase. This makes "sh" restful. :^) There's still some problem with the kernel not surviving the colonel task getting scheduled. I need to figure that out and fix it.
This commit is contained in:
@@ -11,6 +11,11 @@ ZeroDevice::~ZeroDevice()
|
||||
{
|
||||
}
|
||||
|
||||
bool ZeroDevice::hasDataAvailableForRead() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Unix::ssize_t ZeroDevice::read(byte* buffer, Unix::size_t bufferSize)
|
||||
{
|
||||
kprintf("ZeroDevice: read from zero\n");
|
||||
|
||||
Reference in New Issue
Block a user