mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 21:57:35 +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
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)
|
bool GEventLoop::wait_for_specific_event(GUI_ServerMessage::Type type, GUI_ServerMessage& event)
|
||||||
{
|
{
|
||||||
for (;;) {
|
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();
|
bool success = drain_messages_from_server();
|
||||||
if (!success)
|
if (!success)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue