-
Notifications
You must be signed in to change notification settings - Fork 903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove XFlush
call in event loop
#982
Conversation
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 rust-windowing#865
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not know XFlush
had such special semantics. If everything works without it, then we're good removing it.
Now that this has been merged, I think we should release an |
There is still another flush call: |
@aloucks That one appears to be called only when necessary. It doesn't seem to be interfering with the event loop. |
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 rust-windowing#865
Internally,
XFlush
calls_XSend
to write data. It then callsXEventsQueued(display, QueuedAfterReading)
, which reads data from theX 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 nooutput 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 adverselyaffect 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 asXPending
, which writes buffered output but does notso aggressively read from the X server connection.
Closes #865
cargo fmt
has been run on this branchCHANGELOG.md
if knowledge of this change could be valuable to users