Skip to content
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

Fix threading ambiguity in ScanScopes.findRoots() #123

Open
zach-klippenstein opened this issue Jan 22, 2021 · 0 comments
Open

Fix threading ambiguity in ScanScopes.findRoots() #123

zach-klippenstein opened this issue Jan 22, 2021 · 0 comments

Comments

@zach-klippenstein
Copy link
Collaborator

View scanning is performed on the main thread by Radiography.scan. However, finding view roots, via ScanScope.findRoots(), is performed on the calling thread. Some view roots need to run on the main thread or a view-specific thread.

findRoots should get documentation calling out that it can be called on any thread, and the current code should be guarded to make sure it's running on the correct thread. One tricky bit about this is that view scanning is done lazily, via sequences, so scopes that perform operations on sequences need to make sure that's running on the appropriate threads. This could get complicated since sequence items don't include any information about which view they're processing or which thread needs to be used to access that view. Is this laziness really necessary? Would be a lot simpler to do things eagerly, so we don't have to plumb all the information about threading through the system.

I think this might be causing test flakes, so I changed the UI tests to run scan() on the main thread in 03f09c9 for #120. However, this is still a potential issue in production, so we should solve it for real.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant