From 4c51fba01adc4ab274b57916e8d53d8b906d0be2 Mon Sep 17 00:00:00 2001 From: cfsamson Date: Wed, 5 Feb 2020 16:45:03 +0100 Subject: [PATCH] some minor changes --- src/4_pin.md | 2 +- src/6_future_example.md | 12 ++++++++++-- src/8_finished_example.md | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/4_pin.md b/src/4_pin.md index 3b656fe..be30a3d 100644 --- a/src/4_pin.md +++ b/src/4_pin.md @@ -30,7 +30,7 @@ This naming scheme is Rust deliberately testing if you're too tired to safely im `!Unpin` it's a good sign that it's time to lay down the work and start over tomorrow with a fresh mind. -> That was of course a joke. There are very valid reasons for the names +> I hope you didn't mind the joke. There are valid reasons for the names > that were chosen. If you want you can read a bit of the discussion from the > [internals thread][internals_unpin]. The best takeaway from there in my eyes > is this quote from `tmandry`: diff --git a/src/6_future_example.md b/src/6_future_example.md index 3ad0a84..597f13b 100644 --- a/src/6_future_example.md +++ b/src/6_future_example.md @@ -569,7 +569,7 @@ fn main() { # let handle = thread::spawn(move || { # // This simulates some I/O resource # for event in rx { -# println!("GOT EVENT: {:?}", event); +# println!("REACTOR: {:?}", event); # let rl_clone = rl_clone.clone(); # match event { # Event::Close => break, @@ -622,6 +622,14 @@ fn main() { # } ``` +I added a debug printout of the events the reactor registered interest for so we can observe +two things: + +1. How the `Waker` object looks just like the _trait object_ we talked about in an earlier chapter +2. In what order the events register interest with the reactor + +The last point is relevant when we move on the the last paragraph. + ## Async/Await and concurrent Futures This is the first time we actually see the `async/await` syntax so let's @@ -844,7 +852,7 @@ fn main() { # let handle = thread::spawn(move || { # // This simulates some I/O resource # for event in rx { -# println!("GOT EVENT: {:?}", event); +# println!("REACTOR: {:?}", event); # let rl_clone = rl_clone.clone(); # match event { # Event::Close => break, diff --git a/src/8_finished_example.md b/src/8_finished_example.md index 0669c7f..b5455d7 100644 --- a/src/8_finished_example.md +++ b/src/8_finished_example.md @@ -154,7 +154,7 @@ impl Reactor { let handle = thread::spawn(move || { // This simulates some I/O resource for event in rx { - println!("GOT EVENT: {:?}", event); + println!("REACTOR: {:?}", event); let rl_clone = rl_clone.clone(); match event { Event::Close => break,