diff options
author | Tom <tomut@yahoo.com> | 2020-08-03 09:43:19 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-03 18:23:00 +0200 |
commit | f4a5c9b6c2eb6c52fb02b8362f05e33e3e18b1d7 (patch) | |
tree | b57902a850ffc73b4d702217c69463c44de05ec4 /Kernel/Net/LocalSocket.cpp | |
parent | df52061cdbe880d96a01e8a1227917feaad1b87c (diff) | |
download | serenity-f4a5c9b6c2eb6c52fb02b8362f05e33e3e18b1d7.zip |
Kernel: Consolidate timeout logic
Allow passing in an optional timeout to Thread::block and move
the timeout check out of Thread::Blocker. This way all Blockers
implicitly support timeouts and don't need to implement it
themselves. Do however allow them to override timeouts (e.g.
for sockets).
Diffstat (limited to 'Kernel/Net/LocalSocket.cpp')
-rw-r--r-- | Kernel/Net/LocalSocket.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index 63008e2ab0..1dd6a00b5b 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -176,7 +176,7 @@ KResult LocalSocket::connect(FileDescription& description, const sockaddr* addre return KSuccess; } - if (Thread::current()->block<Thread::ConnectBlocker>(description).was_interrupted()) { + if (Thread::current()->block<Thread::ConnectBlocker>(nullptr, description).was_interrupted()) { m_connect_side_role = Role::None; return KResult(-EINTR); } @@ -300,7 +300,7 @@ ssize_t LocalSocket::recvfrom(FileDescription& description, void* buffer, size_t return -EAGAIN; } } else if (!can_read(description, 0)) { - if (Thread::current()->block<Thread::ReadBlocker>(description).was_interrupted()) + if (Thread::current()->block<Thread::ReadBlocker>(nullptr, description).was_interrupted()) return -EINTR; } if (!has_attached_peer(description) && buffer_for_me.is_empty()) |