mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
Userspace: Deal with select() returning EINTR on a signal interruption
Add a trivial CSafeSyscall template that calls a callback until it stops returning EINTR, and use it everywhere we use select() now. Thanks to Andreas for the suggestion of using a template parameter for the syscall function to invoke.
This commit is contained in:
parent
a1eff3daba
commit
f2c0e55070
Notes:
sideshowbarker
2024-07-19 13:06:09 +09:00
Author: https://github.com/rburchell
Commit: f2c0e55070
Pull-request: https://github.com/SerenityOS/serenity/pull/356
5 changed files with 33 additions and 8 deletions
|
@ -3,6 +3,7 @@
|
|||
#include <LibCore/CEventLoop.h>
|
||||
#include <LibCore/CEvent.h>
|
||||
#include <LibCore/CLocalSocket.h>
|
||||
#include <LibCore/CSyscallUtils.h>
|
||||
#include <LibCore/CNotifier.h>
|
||||
#include <LibAudio/ASAPI.h>
|
||||
|
||||
|
@ -106,7 +107,7 @@ public:
|
|||
fd_set rfds;
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(m_connection.fd(), &rfds);
|
||||
int rc = select(m_connection.fd() + 1, &rfds, nullptr, nullptr, nullptr);
|
||||
int rc = CSyscallUtils::safe_syscall(select, m_connection.fd() + 1, &rfds, nullptr, nullptr, nullptr);
|
||||
if (rc < 0) {
|
||||
perror("select");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue