1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00

Kernel: Introduce ThreadBlocker as a way to make unblocking neater :)

And port all the descriptor-based blocks over to it as a proof of concept.
This commit is contained in:
Robin Burchell 2019-07-18 16:22:26 +02:00 committed by Andreas Kling
parent a27c9e3e01
commit 0c8813e6d9
6 changed files with 154 additions and 67 deletions

View file

@ -3,6 +3,7 @@
#include <Kernel/Net/Routing.h>
#include <Kernel/Net/TCP.h>
#include <Kernel/Net/TCPSocket.h>
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/Process.h>
Lockable<HashMap<u16, TCPSocket*>>& TCPSocket::sockets_by_port()
@ -161,7 +162,7 @@ KResult TCPSocket::protocol_connect(FileDescription& description, ShouldBlock sh
m_state = State::Connecting;
if (should_block == ShouldBlock::Yes) {
current->block(Thread::BlockedConnect, description);
current->block(*new Thread::ThreadBlockerConnect(description));
ASSERT(is_connected());
return KSuccess;
}