Skip to content

Commit

Permalink
Remove XFlush call in event loop (#982)
Browse files Browse the repository at this point in the history
Internally, `XFlush` calls `_XSend` to write data. It then calls
`XEventsQueued(display, QueuedAfterReading)`, which reads data from the
X server connection. This prevents the event loop source callback from
being run, as there is no longer data waiting on the socket.

Ideally, we would want to call `_XSend` directly to ensure that no
output is buffered by Xlib. However, this function is not exported as
part of Xlib's public API.

Testing with the `XFlush` call removed does not appear to adversely
affect the performance of an application. If any bugs should eventually
arise from this change, perhaps another function may be used in place of
`XFlush`, such as `XPending`, which writes buffered output but does not
so aggressively read from the X server connection.

Closes #865
  • Loading branch information
murarth authored and goddessfreya committed Jun 25, 2019
1 parent 3555de1 commit 29e2481
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/platform_impl/linux/x11/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,6 @@ impl<T: 'static> EventLoop<T> {
);
}

// flush the X11 connection
unsafe {
(wt.xconn.xlib.XFlush)(wt.xconn.display);
}

match control_flow {
ControlFlow::Exit => break,
ControlFlow::Poll => {
Expand Down

0 comments on commit 29e2481

Please sign in to comment.