mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 15:19:42 +00:00
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).
This commit is contained in:
parent
df52061cdb
commit
f4a5c9b6c2
Notes:
sideshowbarker
2024-07-19 04:21:12 +09:00
Author: https://github.com/tomuta
Commit: f4a5c9b6c2
Pull-request: https://github.com/SerenityOS/serenity/pull/2980
15 changed files with 60 additions and 77 deletions
|
@ -246,7 +246,7 @@ ssize_t IPv4Socket::receive_byte_buffered(FileDescription& description, void* bu
|
|||
return -EAGAIN;
|
||||
|
||||
locker.unlock();
|
||||
auto res = Thread::current()->block<Thread::ReadBlocker>(description);
|
||||
auto res = Thread::current()->block<Thread::ReadBlocker>(nullptr, description);
|
||||
locker.lock();
|
||||
|
||||
if (!m_can_read) {
|
||||
|
@ -296,7 +296,7 @@ ssize_t IPv4Socket::receive_packet_buffered(FileDescription& description, void*
|
|||
}
|
||||
|
||||
locker.unlock();
|
||||
auto res = Thread::current()->block<Thread::ReadBlocker>(description);
|
||||
auto res = Thread::current()->block<Thread::ReadBlocker>(nullptr, description);
|
||||
locker.lock();
|
||||
|
||||
if (!m_can_read) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue