Removed the explicit call to close and mentioned a bug that can occur
when two tasks is given the same id. The explicit close call is not needed. We can do that in the `Drop` implementation instead. It's better to have accounting tasks like this only one place and it didn't add anything to the example. There is a subtle bug which occurs if two tasks are given the same Id. I mentioned this explicitly since it's such an easy thing to do. I added the fix as a reader excercise since for the examples sake I think it's better to pass them in explicitly so that we don't "pollute" the example with more code than strictly needed to get an understanding of futures.
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
The rendered version is found at: [https://cfsamson.github.io/books-futures-explained/](https://cfsamson.github.io/books-futures-explained/)
|
||||
|
||||
You can find the main example in the repository [examples-futures](https://github.com/cfsamson/examples-futures).
|
||||
|
||||
This book aims to explain `Futures` in Rust using an example driven approach,
|
||||
exploring why they're designed the way they are, and how they work. We'll also
|
||||
take a look at some of the alternatives we have when dealing with concurrency
|
||||
|
||||
Reference in New Issue
Block a user