summaryrefslogtreecommitdiff
path: root/Kernel/TTY/SlavePTY.cpp
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2020-11-29 16:05:27 -0700
committerAndreas Kling <kling@serenityos.org>2020-11-30 13:17:02 +0100
commit046d6855f5e8a5039b319a47c3018a16d4c2f960 (patch)
tree9021179989bea74ec7d14a4c30d77eb2b2609f23 /Kernel/TTY/SlavePTY.cpp
parent6a620562cc7298c2f591a06817ff560c9ef1deac (diff)
downloadserenity-046d6855f5e8a5039b319a47c3018a16d4c2f960.zip
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.
Diffstat (limited to 'Kernel/TTY/SlavePTY.cpp')
-rw-r--r--Kernel/TTY/SlavePTY.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/Kernel/TTY/SlavePTY.cpp b/Kernel/TTY/SlavePTY.cpp
index e7daab0a39..8d74137d69 100644
--- a/Kernel/TTY/SlavePTY.cpp
+++ b/Kernel/TTY/SlavePTY.cpp
@@ -71,10 +71,11 @@ void SlavePTY::on_master_write(const UserOrKernelBuffer& buffer, ssize_t size)
{
ssize_t nread = buffer.read_buffered<128>(size, [&](const u8* data, size_t data_size) {
for (size_t i = 0; i < data_size; ++i)
- emit(data[i]);
+ emit(data[i], false);
return (ssize_t)data_size;
});
- (void)nread;
+ if (nread > 0)
+ evaluate_block_conditions();
}
ssize_t SlavePTY::on_tty_write(const UserOrKernelBuffer& data, ssize_t size)
@@ -108,4 +109,9 @@ KResult SlavePTY::close()
return KSuccess;
}
+FileBlockCondition& SlavePTY::block_condition()
+{
+ return m_master->block_condition();
+}
+
}