mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
LibGUI: Yield (using select()) in GEventLoop::wait_for_specific_event().
This is factored a bit stupidly. It would be nicer to just have the read() in drain_events_from_server() be blocking, but the fd is opened with O_NONBLOCK right now. This makes everything run real snappy once again. :^)
This commit is contained in:
parent
222a6f7bbc
commit
427df5f312
Notes:
sideshowbarker
2024-07-19 15:45:13 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/427df5f312b
1 changed files with 6 additions and 0 deletions
|
@ -365,6 +365,12 @@ bool GEventLoop::post_message_to_server(const GUI_ClientMessage& message)
|
|||
bool GEventLoop::wait_for_specific_event(GUI_ServerMessage::Type type, GUI_ServerMessage& event)
|
||||
{
|
||||
for (;;) {
|
||||
fd_set rfds;
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(m_event_fd, &rfds);
|
||||
int rc = select(m_event_fd + 1, &rfds, nullptr, nullptr, nullptr);
|
||||
ASSERT(rc > 0);
|
||||
ASSERT(FD_ISSET(m_event_fd, &rfds));
|
||||
bool success = drain_messages_from_server();
|
||||
if (!success)
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue