mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 12:45:07 +00:00
CEventLoop: Oops, I had the pipe reader/writer fd's mixed up.
This commit is contained in:
parent
4c0c93ce09
commit
e8d61bb8c0
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;
|
int max_fd_added = -1;
|
||||||
add_file_descriptors_for_select(rfds, max_fd_added);
|
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);
|
max_fd = max(max_fd, max_fd_added);
|
||||||
for (auto& notifier : *s_notifiers) {
|
for (auto& notifier : *s_notifiers) {
|
||||||
if (notifier->event_mask() & CNotifier::Read)
|
if (notifier->event_mask() & CNotifier::Read)
|
||||||
|
@ -209,9 +209,14 @@ void CEventLoop::wait_for_event(WaitMode mode)
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FD_ISSET(s_wake_pipe_fds[1], &rfds)) {
|
if (FD_ISSET(s_wake_pipe_fds[0], &rfds)) {
|
||||||
char buffer[32];
|
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()) {
|
if (!s_timers->is_empty()) {
|
||||||
|
@ -314,7 +319,7 @@ void CEventLoop::unregister_notifier(Badge<CNotifier>, CNotifier& notifier)
|
||||||
void CEventLoop::wake()
|
void CEventLoop::wake()
|
||||||
{
|
{
|
||||||
char ch = '!';
|
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) {
|
if (nwritten < 0) {
|
||||||
perror("CEventLoop::wake: write");
|
perror("CEventLoop::wake: write");
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue