Closed ComicSansMS closed 4 months ago
Thank you for the feedback. Indeed, threads2
has been simplified in the main
branch. The next release will ship the simplified exercise. Feedback to the simplified version is welcome:
https://github.com/rust-lang/rustlings/blob/71053101c32d0fd374f8e122880b3d682519bac6/exercises/20_threads/threads2.rs
@mo8it I lost track of when my changes were made and when I updated the exercise, so my feedback is not super clear, but in terms of general feeling I find this exercise a bit confusing and not as well-written as the others. Same with threads3, I think - there is just no description at all of what the goal of the exercise is, other than the default "make it compile and tests pass". This is not as educational as actually describing what the exercise is about and what we're trying to accomplish.
Edit: basically, I am doing Rustlings so that I have to read the book as little as possible, and these two exercises don't really help with that. I hope the next chapter will get back to the previous level of doing-that-ness.
@brunoparga I am open to suggestions for improving the current version of the exercise :)
threads2.rs contains the following comment on the second TODO:
I think the "did you notice..." here is potentially misleading. It is not unlikely that users will get an output of 10 times
jobs completed 10
, even several times in a row. In this case the note might mislead them into concluding that it is guaranteed thatjobs_completed
will always be at its maximum value after the first handle has joined, and it would therefore not be necessary to join all the handles.I made the same mistake initially, but eventually realized that this behavior is timing dependent and can be changed very visibly by, for example, having each thread sleep for a different amount of time. If I had been less careful, I may have moved on believing that the note suggested it was not necessary to join all the handles.
Not wanting to call anyone out here for making a mistake, but a quick google search for "rustlings threads2" shows multiple examples of people falling into that same trap.
I am still unsure at this point what the original purpose of the question "Do you have to 'join' on all the handles?" is here. I feel it would be less misleading if it was phrased in a way like "Is the output always consistent between multiple runs? Why is it necessary to 'join' on all the handles?". Would such a phrasing still be in line with the original intention?