mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:47:44 +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:
parent
ba56f4afde
commit
c6f2890d8e
18 changed files with 86 additions and 17 deletions
|
@ -31,11 +31,12 @@ public:
|
|||
Invalid = 0,
|
||||
Runnable = 1,
|
||||
Running = 2,
|
||||
BlockedSleep = 3,
|
||||
BlockedWait = 4,
|
||||
Terminated = 5,
|
||||
Crashing = 6,
|
||||
Exiting = 7,
|
||||
Terminated = 3,
|
||||
Crashing = 4,
|
||||
Exiting = 5,
|
||||
BlockedSleep = 6,
|
||||
BlockedWait = 7,
|
||||
BlockedRead = 8,
|
||||
};
|
||||
|
||||
enum RingLevel {
|
||||
|
@ -114,6 +115,7 @@ public:
|
|||
|
||||
private:
|
||||
friend class MemoryManager;
|
||||
friend bool scheduleNewTask();
|
||||
|
||||
Task(String&& name, uid_t, gid_t, pid_t parentPID, RingLevel);
|
||||
|
||||
|
@ -143,6 +145,7 @@ private:
|
|||
void* m_kernelStack { nullptr };
|
||||
dword m_timesScheduled { 0 };
|
||||
pid_t m_waitee { -1 };
|
||||
int m_fdBlockedOnRead { -1 };
|
||||
|
||||
String m_cwd;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue