-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[doc] Fix multi-threading example in dining-philosophers #26990
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Oh man, I didn't notice the philosophers names are different. |
The current example does actually show off multithreading, it's just not as interleaved as one might expect because you have to lock your fork on the table and if you can't you haven't started eating. The actual scenario where everyone starts eating all at once before anyone has finished is impossible because there aren't enough forks to go around. Thanks for the PR though! |
At the point that I've edited we still don't have any locks/forks. This is the example where everyone start at the same time, wait 1 second and then finish, roughly at the same time again. Mutexes (forks) are added in the next step. The output I've fixed reflects what I was actually getting implementing the example. |
Oh oops sorry, missed that part! |
The current example does not illustrate threaded behavior imo.
The current example does not illustrate threaded behavior imo.