Skip to content

Commit

Permalink
Clarify variable naming in async.md (#718)
Browse files Browse the repository at this point in the history
It's a little bit confusing for a newcomer that notify one method is called on notify two -- it gives wrong hint/intuition to some readers, so it worth to choose a name which won't suggest such semantic, which isn't there.

Looks like this part of code is only in tutorial text, and nothing to sync in the supplementary code.
  • Loading branch information
skaunov authored Oct 4, 2023
1 parent 48e89ba commit eb4c693
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions content/tokio/tutorial/async.md
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ use std::thread;
async fn delay(dur: Duration) {
let when = Instant::now() + dur;
let notify = Arc::new(Notify::new());
let notify2 = notify.clone();
let notify_clone = notify.clone();

thread::spawn(move || {
let now = Instant::now();
Expand All @@ -801,7 +801,7 @@ async fn delay(dur: Duration) {
thread::sleep(when - now);
}

notify2.notify_one();
notify_clone.notify_one();
});


Expand Down

0 comments on commit eb4c693

Please sign in to comment.