RemoveCurrent method for thread context sharing #398
Merged
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.
This PR contains a subpart of commits from PR #389 which deals with context sharing. I am submitting this set of commits since it is already useful for X11+GLX and removes the requirement to rebase these commits on master for maintaining the
x11_egl
branch.As discussed in #395, thread local storage only works for sequentially created threads. I.e. it does not work in the
HelloPangolinThreads
example, where a window is created in the main thread and rendering is done in a separate run thread.The PR mainly adds a new method
RemoveCurrent
forWindowInterface
/PangolinGl
which is supposed to unbind the current context. As shown in the example, it needs to be called at the end of a thread, before switching to another thread. The current behaviour for sequential threading is not affected, i.e. sequential threads do not require to callRemoveCurrent
.This is tested and working as intended in the
HelloPangolinThreads
example with X11+GLX and X11+EGL.