-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Better separation between UI thread and Map thread #1065
Conversation
How do you decide what goes in |
All data that is shared between the main thread and the map thread goes into MapData, the rest goes into MapContext. Eventually this should be 0, so MapData goes away and data lives either on the main thread (in the |
👍, sounds good. |
This is more of a work in progress and not intended to be merged as is. |
What tasks are remaining, in your mind? |
Mostly removal of accessing |
8592a7b
to
1f408af
Compare
d1c338f
to
e3ab283
Compare
I started looking at what needs to happen to privatize the remaining members of MapContext. The asyncs were the first target. They are currently public because they are used for control flow in the static rendering case. I think we should replace this with explicit checks of whether all resources are ready (i.e. port |
|
Is this for sure necessary? |
@jfirebaugh As you're digging into this, I would love if you could keep an eye out for threading issues that could possibly be causing https://github.com/mapbox/api-gl/issues/16 and https://github.com/mapbox/node-mapbox-gl-native/issues/114? |
Not 100% sure, but there could be situations where we end an event loop, and destroy it, but don't run the callbacks from |
Why not call MapContext Map::Impl like we do for the other objects? |
@mikemorris Will do.
Yeah, I was considering renaming it later on, when everything is working again. |
fb35ff3
to
aaf0c95
Compare
Got it to compile for the first time using
Going to start looking at how @kkaefer is restructuring this in |
What is the purpose of |
@kkaefer Can you give an outline of your strategy with |
@mikemorris @kkaefer Is it essential that |
Environment::abandonVAOs was added to make sure that buffers for DebugBucket get also deleted in the mapThread. Prior to this change, it used to result in "Opengl thread conflict" error. |
Current status: GLFW-based app is working. Headless rendering hangs. iOS / Android are probably failing to build. |
776612e
to
084f90b
Compare
So I know there were problems with simply using |
I'd like to keep |
084f90b
to
2fee882
Compare
66114f0
to
a264ff5
Compare
The previous implementation, based on thread-local storage, did not ensure that the context was destructed before the FileSource run loop. This resulted in implementations attempting to uv_close handles for a loop that had already been destroyed. This change also fixes #1262.
a264ff5
to
481fa0e
Compare
I'm still chasing a crash in the headless tests on Travis (can't reproduce locally), but it doesn't seem to manifest anywhere else and we need to get this into wider testing. I'm going to disable the failing tests temporarily, merge the branch, and then resume banging my head against the wall. |
👍 We can roll a new Sirius later today to get this into wider circulation ASAP. |
Better separation between UI thread and Map thread
Merged! Closing a bunch of issues that are known to be fixed or likely to be fixed by these changes. Please open new issues for any crashers observed post-merge. |
Let’s get this into a build today along with whatever else we can scare up, code or design. /cc @samanpwbb @peterqliu @nickidlugash @andreasviglakis |
TODO list:
data.callback
is not threadsafeView
and subclasses to interact with a single thread only (either main or map)