mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
CEventLoop: Oops, I had the pipe reader/writer fd's mixed up.
This commit is contained in:
parent
4c0c93ce09
commit
e8d61bb8c0
Notes:
sideshowbarker
2024-07-19 13:16:28 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/e8d61bb8c05
1 changed files with 9 additions and 4 deletions
|
@ -172,7 +172,7 @@ void CEventLoop::wait_for_event(WaitMode mode)
|
|||
|
||||
int max_fd_added = -1;
|
||||
add_file_descriptors_for_select(rfds, max_fd_added);
|
||||
add_fd_to_set(s_wake_pipe_fds[1], rfds);
|
||||
add_fd_to_set(s_wake_pipe_fds[0], rfds);
|
||||
max_fd = max(max_fd, max_fd_added);
|
||||
for (auto& notifier : *s_notifiers) {
|
||||
if (notifier->event_mask() & CNotifier::Read)
|
||||
|
@ -209,9 +209,14 @@ void CEventLoop::wait_for_event(WaitMode mode)
|
|||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
if (FD_ISSET(s_wake_pipe_fds[1], &rfds)) {
|
||||
if (FD_ISSET(s_wake_pipe_fds[0], &rfds)) {
|
||||
char buffer[32];
|
||||
read(s_wake_pipe_fds[1], buffer, sizeof(buffer));
|
||||
auto nread = read(s_wake_pipe_fds[0], buffer, sizeof(buffer));
|
||||
if (nread < 0) {
|
||||
perror("read from wake pipe");
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
ASSERT(nread > 0);
|
||||
}
|
||||
|
||||
if (!s_timers->is_empty()) {
|
||||
|
@ -314,7 +319,7 @@ void CEventLoop::unregister_notifier(Badge<CNotifier>, CNotifier& notifier)
|
|||
void CEventLoop::wake()
|
||||
{
|
||||
char ch = '!';
|
||||
int nwritten = write(s_wake_pipe_fds[0], &ch, 1);
|
||||
int nwritten = write(s_wake_pipe_fds[1], &ch, 1);
|
||||
if (nwritten < 0) {
|
||||
perror("CEventLoop::wake: write");
|
||||
ASSERT_NOT_REACHED();
|
||||
|
|
Loading…
Add table
Reference in a new issue