-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
Improve model loading messages (long-lived background thread) #1476
Improve model loading messages (long-lived background thread) #1476
Conversation
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.
Thank you, @zthompson47, this is great!
I tested this, and it works great. I also reviewed the code and it looks good. I left comments where things jumped out to me, but none of that is a blocker.
You said that you wanted to do more cleanup and write tests before merging. While that would be very welcome, I'd be more than happy to merge this as-is. It is a clear improvement, after all, fixing two issues!
Additional cleanup and testing can be submitted in follow-up pull requests. This would also reduce the likelihood of other pull requests causing merge conflicts here in the meantime. What do you think?
One caveat: I haven't looked at #1477 yet (will do so soon), so maybe I'll end up liking that better. However, based on our conversation in #1431, I believe that the "long-lived thread" approach from this pull request is likely to be the better one.
@@ -3,17 +3,19 @@ | |||
//! Provides the functionality to create a window and perform basic viewing | |||
//! with programmed models. | |||
|
|||
#![allow(clippy::result_large_err)] |
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.
See previous comment about #![allow(...)]
.
Thanks for review and comments - very helpful! | Additional cleanup and testing can be submitted in follow-up pull requests I'll resolve the above conversations and we can merge this in. |
`Host` now runs in a background thread and moves model processing out of the `winit` event loop. It controls more of the model loading process and can provide better status messages to display to the user.
This commit also fixed the timing of the `StartWatching` status message.
Instead of exposing the separation of a host background thead and an associated handle, create a single host constructor to use in the public api.
The struct names were changed, so rename the files accordingly.
0773c4c
to
815dea7
Compare
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.
Thank you, @zthompson47, those latest changes look great!
I just did a rebase to get this up-to-date with main
, and will merge as soon as CI is green.
Thanks for all the help getting that PR merged! I never did that last edit to sort out the issue with |
No problem. It was you who did all of the work!
Different projects handle that kind of stuff differently. Myself, I'm pretty flexible in how to do things, as I want to encourage contributions, and I don't think it's reasonable to expect every contributor to read a thick "how we do it" handbook. That said, these are my preferences:
|
This PR fixes #1431 and fixes #1327 by spawning a host background thread that lives outside of the the event loop. A handle is used inside the event loop to send new models for processing. Status messages are sent back to the event loop via
winit::event_loop::EventLoopProxy
.