mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 03:37:53 +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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user