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

threads1.rs breakdown suggestion #892

Closed
jaystile opened this issue Dec 23, 2021 · 1 comment
Closed

threads1.rs breakdown suggestion #892

jaystile opened this issue Dec 23, 2021 · 1 comment
Assignees

Comments

@jaystile
Copy link
Contributor

I recently finished the rustlings course at version 4.6.0. I noted in the hint for threads1.rs looked like a cry for help: Ok, so, real talk, this was actually tricky for me to do too. And I could see a lot of different problems you might run into, so at this
point I'm not sure which one you've hit :)
I also had trouble implementing the exercise. I borrowed heavily from the last section of the book on threads. It involved adding the Mutex, moving the 'status.clone()' into the loop, and then unwrapping the mutex to check for if the number of threads has been completed. It was a lot of edits for the single exercise. It seemed odd to check the value to see if the threads had finished.

My recommendation, is to split threads1.rs into two exercises

  1. threads1.rs would focus on using the JoinHandle result from spawning 10 threads and waiting the threads to finish.
  2. threads2.rs starts with the result from threads1.rs. It then stubs out the Arc and hints for the Mutex implementation to change shared data. Ask for the final value held by the mutex at the end of the exercise.
@jaystile jaystile changed the title thread1.rs breakdown suggestion threads1.rs breakdown suggestion Dec 23, 2021
shadows-withal pushed a commit that referenced this issue Jul 15, 2022
spawned threads to finish. Moved the original threads1.rs to threads2.rs
with the focus on the Mutex and modifying shared data. #892
@YDX-2147483647
Copy link

YDX-2147483647 commented Sep 11, 2022

It seems that b4f52cb has fixed it. So this issue should be closed now?

dmoore04 pushed a commit to dmoore04/rustlings that referenced this issue Sep 11, 2022
spawned threads to finish. Moved the original threads1.rs to threads2.rs
with the focus on the Mutex and modifying shared data. rust-lang#892
Spacebody pushed a commit to Spacebody/my-rustlings that referenced this issue Nov 18, 2022
spawned threads to finish. Moved the original threads1.rs to threads2.rs
with the focus on the Mutex and modifying shared data. rust-lang#892
ComixHe pushed a commit to ComixHe/rustlings that referenced this issue Jun 20, 2023
spawned threads to finish. Moved the original threads1.rs to threads2.rs
with the focus on the Mutex and modifying shared data. rust-lang#892
@mo8it mo8it self-assigned this Mar 30, 2024
@mo8it mo8it closed this as completed Jul 10, 2024
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

Successfully merging a pull request may close this issue.

3 participants