mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 11:55:12 +00:00
Kernel: Move block condition evaluation out of the Scheduler
This makes the Scheduler a lot leaner by not having to evaluate block conditions every time it is invoked. Instead evaluate them as the states change, and unblock threads at that point. This also implements some more waitid/waitpid/wait features and behavior. For example, WUNTRACED and WNOWAIT are now supported. And wait will now not return EINTR when SIGCHLD is delivered at the same time.
This commit is contained in:
parent
6a620562cc
commit
046d6855f5
53 changed files with 2027 additions and 930 deletions
|
@ -47,8 +47,10 @@ InodeFile::~InodeFile()
|
|||
KResultOr<size_t> InodeFile::read(FileDescription& description, size_t offset, UserOrKernelBuffer& buffer, size_t count)
|
||||
{
|
||||
ssize_t nread = m_inode->read_bytes(offset, count, buffer, &description);
|
||||
if (nread > 0)
|
||||
if (nread > 0) {
|
||||
Thread::current()->did_file_read(nread);
|
||||
evaluate_block_conditions();
|
||||
}
|
||||
if (nread < 0)
|
||||
return KResult(nread);
|
||||
return nread;
|
||||
|
@ -60,6 +62,7 @@ KResultOr<size_t> InodeFile::write(FileDescription& description, size_t offset,
|
|||
if (nwritten > 0) {
|
||||
m_inode->set_mtime(kgettimeofday().tv_sec);
|
||||
Thread::current()->did_file_write(nwritten);
|
||||
evaluate_block_conditions();
|
||||
}
|
||||
if (nwritten < 0)
|
||||
return KResult(nwritten);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue