x11: thread safe replacement for XNextEvent#782
Merged
august64 merged 2 commits intorust-windowing:masterfrom Feb 24, 2019
Merged
x11: thread safe replacement for XNextEvent#782august64 merged 2 commits intorust-windowing:masterfrom
august64 merged 2 commits intorust-windowing:masterfrom
Conversation
XNextEvent will block for input while holding the global Xlib mutex. This will cause a deadlock in even the most trivial multi-threaded application because OpenGL functions will need to hold the Xlib mutex too. Add EventsLoop::poll_one_event and EventsLoop::wait_for_input to provide thread-safe functions to poll and wait events from the X11 event queue using unix select(2) and XCheckIfEvent. This is a somewhat ugly workaround to an ugly problem. Fixes rust-windowing#779
|
@francesca64 ping (fixed version of #781 ) |
august64
approved these changes
Feb 23, 2019
Member
august64
left a comment
There was a problem hiding this comment.
Sorry for the delay! Looks great, and I'm happy to see this long-standing issue fixed! (I really appreciate the informative comments, too.)
I don't currently have access to a Linux box, so could @mitchmindtree / @vberger / etc. test that this works as expected?
Contributor
|
I tested some of the winit examples with this on x11, and it seems to work smoothly. |
elinorbgr
pushed a commit
to elinorbgr/winit
that referenced
this pull request
Apr 7, 2019
XNextEvent will block for input while holding the global Xlib mutex. This will cause a deadlock in even the most trivial multi-threaded application because OpenGL functions will need to hold the Xlib mutex too. Add EventsLoop::poll_one_event and EventsLoop::wait_for_input to provide thread-safe functions to poll and wait events from the X11 event queue using unix select(2) and XCheckIfEvent. This is a somewhat ugly workaround to an ugly problem. Fixes rust-windowing#779
elinorbgr
pushed a commit
to elinorbgr/winit
that referenced
this pull request
Apr 7, 2019
XNextEvent will block for input while holding the global Xlib mutex. This will cause a deadlock in even the most trivial multi-threaded application because OpenGL functions will need to hold the Xlib mutex too. Add EventsLoop::poll_one_event and EventsLoop::wait_for_input to provide thread-safe functions to poll and wait events from the X11 event queue using unix select(2) and XCheckIfEvent. This is a somewhat ugly workaround to an ugly problem. Fixes rust-windowing#779
felixrabe
pushed a commit
to felixrabe/winit
that referenced
this pull request
Jun 30, 2019
XNextEvent will block for input while holding the global Xlib mutex. This will cause a deadlock in even the most trivial multi-threaded application because OpenGL functions will need to hold the Xlib mutex too. Add EventsLoop::poll_one_event and EventsLoop::wait_for_input to provide thread-safe functions to poll and wait events from the X11 event queue using unix select(2) and XCheckIfEvent. This is a somewhat ugly workaround to an ugly problem. Fixes rust-windowing#779
kosyak
pushed a commit
to kosyak/winit
that referenced
this pull request
Jul 10, 2019
XNextEvent will block for input while holding the global Xlib mutex. This will cause a deadlock in even the most trivial multi-threaded application because OpenGL functions will need to hold the Xlib mutex too. Add EventsLoop::poll_one_event and EventsLoop::wait_for_input to provide thread-safe functions to poll and wait events from the X11 event queue using unix select(2) and XCheckIfEvent. This is a somewhat ugly workaround to an ugly problem. Fixes rust-windowing#779
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
XNextEvent will block for input while holding the global Xlib mutex.
This will cause a deadlock in even the most trivial multi-threaded
application because OpenGL functions will need to hold the Xlib mutex
too.
Add EventsLoop::poll_one_event and EventsLoop::wait_for_input to provide
thread-safe functions to poll and wait events from the X11 event queue
using unix select(2) and XCheckIfEvent.
This is a somewhat ugly workaround to an ugly problem.
Fixes #779
CHANGELOG.mdif knowledge of this change could be valuable to users