mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +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:
@@ -70,6 +70,7 @@ void Socket::set_setup_state(SetupState new_setup_state)
|
||||
#endif
|
||||
|
||||
m_setup_state = new_setup_state;
|
||||
evaluate_block_conditions();
|
||||
}
|
||||
|
||||
RefPtr<Socket> Socket::accept()
|
||||
@@ -86,6 +87,8 @@ RefPtr<Socket> Socket::accept()
|
||||
client->m_acceptor = { process.pid().value(), process.uid(), process.gid() };
|
||||
client->m_connected = true;
|
||||
client->m_role = Role::Accepted;
|
||||
if (!m_pending.is_empty())
|
||||
evaluate_block_conditions();
|
||||
return client;
|
||||
}
|
||||
|
||||
@@ -98,6 +101,7 @@ KResult Socket::queue_connection_from(NonnullRefPtr<Socket> peer)
|
||||
if (m_pending.size() >= m_backlog)
|
||||
return KResult(-ECONNREFUSED);
|
||||
m_pending.append(peer);
|
||||
evaluate_block_conditions();
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user