From 046d6855f5e8a5039b319a47c3018a16d4c2f960 Mon Sep 17 00:00:00 2001 From: Tom Date: Sun, 29 Nov 2020 16:05:27 -0700 Subject: 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. --- Kernel/DoubleBuffer.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Kernel/DoubleBuffer.h') diff --git a/Kernel/DoubleBuffer.h b/Kernel/DoubleBuffer.h index b855fb8853..6db3718b8e 100644 --- a/Kernel/DoubleBuffer.h +++ b/Kernel/DoubleBuffer.h @@ -29,6 +29,7 @@ #include #include #include +#include #include namespace Kernel { @@ -53,6 +54,12 @@ public: size_t space_for_writing() const { return m_space_for_writing; } + void set_unblock_callback(Function callback) + { + ASSERT(!m_unblock_callback); + m_unblock_callback = move(callback); + } + private: void flip(); void compute_lockfree_metadata(); @@ -68,6 +75,7 @@ private: InnerBuffer m_buffer2; KBuffer m_storage; + Function m_unblock_callback; size_t m_capacity { 0 }; size_t m_read_buffer_index { 0 }; size_t m_space_for_writing { 0 }; -- cgit v1.2.3