1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:57:44 +00:00

Support polling with select() by using a zero timeout.

Use this in WindowServer to avoid getting blocked in select() when
there are pending injected events.
This commit is contained in:
Andreas Kling 2019-01-18 05:26:45 +01:00
parent a01e119e05
commit dff5051905
4 changed files with 24 additions and 7 deletions

View file

@ -110,7 +110,11 @@ void WSEventLoop::wait_for_event()
params.readfds = &rfds;
params.writefds = nullptr;
params.exceptfds = nullptr;
params.timeout = nullptr;
struct timeval timeout = { 0, 0 };
if (m_queued_events.is_empty())
params.timeout = nullptr;
else
params.timeout = &timeout;
int rc = m_server_process->sys$select(&params);
memory_barrier();
if (rc < 0) {