-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Simplify winit runner exit code reporting #13151
Conversation
The original plan was to switch to a arc containing a atomic u8. Although such a solution would use much less memory it would be rather annoying to deal with. |
Is there a specific issue for this, or do you have a reproduction? I'm curious of the cause behind this change. |
Personally, I think using atomics in this situation would not be too bad; we just use Then again, I may be more familiar with concurrency. |
My phrasing was rather hyperbolic, sorry. It was predicated on the possibility of the event_loop getting leaked for some reason. I've realized that this wouldn't actually deadlock but would cause a panic when the
Using a channel means we get to detect situations in which, a future maintainer working on the event loop forgets to set an exit code before exiting the event loop. Though my primary reasoning for not using atomics is that the code would be harder to parse. On the ordering of operations. We could use |
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.
I'm not familiar with the event loop, so I recommend getting one more approval before merging.
Either way, your reasoning makes sense! I have a few small notes, but nothing blocking.
@pietrosophya could you take a quick look at this if you have the time and interest? |
Objective
Returning a app exit code from the winit runner is complicated and deadlock prone.The code to return a app exit code is rather shoddy. It's use of mutex is redundant, It uses unwrap when not required and can be broken by a maintainer simply forgetting to set a value.
Solution
Switch to using a channel.