mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:17:35 +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
|
@ -29,6 +29,7 @@
|
|||
#include <AK/Types.h>
|
||||
#include <Kernel/KBuffer.h>
|
||||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/Thread.h>
|
||||
#include <Kernel/UserOrKernelBuffer.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -53,6 +54,12 @@ public:
|
|||
|
||||
size_t space_for_writing() const { return m_space_for_writing; }
|
||||
|
||||
void set_unblock_callback(Function<void()> 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<void()> m_unblock_callback;
|
||||
size_t m_capacity { 0 };
|
||||
size_t m_read_buffer_index { 0 };
|
||||
size_t m_space_for_writing { 0 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue