-
Notifications
You must be signed in to change notification settings - Fork 341
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
Some edits for Tutorial: Shared State #768
Some edits for Tutorial: Shared State #768
Conversation
- Moved Tasks, threads and contention to the end: - This is deeper and more detailed than the previous sections - Also, the part on restructuring the code should be higher up - Added more warnings on Send Guards. - Linking to Alice Ryhl's post twice, both segments seem to benefit from this link. This PR has some "quick fixes", that I believe would be helpful for tokio users at large. The best thing we could do I believe, however, would be to sanitize the examples, so that all the example code would have wrapped mutexes only, making it much less likely for tokio users to end up with problematic code.
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.
A few small comments. Mostly I think that the heading "Most of the tiem, don't use std::sync::Mutex
" is the best choice.
Co-authored-by: Hayden Stainsby <hds@caffeineconcepts.com>
Co-authored-by: Hayden Stainsby <hds@caffeineconcepts.com>
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.
Overall looks reasonable. I agree with @hds on the title at the top of the diff.
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.
Looking great now, thanks for your changes!
This PR has some "quick fixes", that I believe would be helpful for tokio users at large.
The best thing we could do I believe, however, would be to sanitize the examples, so that all the example code would have wrapped mutexes only, making it much less likely for tokio users to end up with problematic code.