mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:17:34 +00:00
GEventLoop: Quit the event loop on EOF from the WindowServer.
This commit is contained in:
parent
fe2fa4ac80
commit
3ecfde193a
1 changed files with 10 additions and 1 deletions
|
@ -399,6 +399,7 @@ void GEventLoop::process_unprocessed_messages()
|
||||||
|
|
||||||
bool GEventLoop::drain_messages_from_server()
|
bool GEventLoop::drain_messages_from_server()
|
||||||
{
|
{
|
||||||
|
bool is_first_pass = true;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
WSAPI_ServerMessage message;
|
WSAPI_ServerMessage message;
|
||||||
ssize_t nread = read(s_event_fd, &message, sizeof(WSAPI_ServerMessage));
|
ssize_t nread = read(s_event_fd, &message, sizeof(WSAPI_ServerMessage));
|
||||||
|
@ -407,10 +408,17 @@ bool GEventLoop::drain_messages_from_server()
|
||||||
quit(1);
|
quit(1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (nread == 0)
|
if (nread == 0) {
|
||||||
|
if (is_first_pass) {
|
||||||
|
fprintf(stderr, "EOF on WindowServer fd\n");
|
||||||
|
quit(1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
assert(nread == sizeof(message));
|
assert(nread == sizeof(message));
|
||||||
m_unprocessed_messages.append(move(message));
|
m_unprocessed_messages.append(move(message));
|
||||||
|
is_first_pass = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,6 +490,7 @@ bool GEventLoop::post_message_to_server(const WSAPI_ClientMessage& message)
|
||||||
|
|
||||||
bool GEventLoop::wait_for_specific_event(WSAPI_ServerMessage::Type type, WSAPI_ServerMessage& event)
|
bool GEventLoop::wait_for_specific_event(WSAPI_ServerMessage::Type type, WSAPI_ServerMessage& event)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
fd_set rfds;
|
fd_set rfds;
|
||||||
FD_ZERO(&rfds);
|
FD_ZERO(&rfds);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue