-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ch. 17: start in earnest on §2, showing relation to threads
Add some listings which I can actually run, with `TODO` paths in them since I do not know what the numbers will be, since I have not actually finished with §0 or §1 yet!
- Loading branch information
1 parent
cb376b3
commit 43d0ee8
Showing
10 changed files
with
1,814 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "async_await" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
trpl = { path = "../../../packages/trpl" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use std::time::Duration; | ||
|
||
fn main() { | ||
trpl::block_on(async { | ||
trpl::spawn_task(async { | ||
for i in 1..10 { | ||
println!("hi number {i} from the first task!"); | ||
trpl::sleep(Duration::from_millis(1)).await; | ||
} | ||
}); | ||
|
||
for i in 1..5 { | ||
println!("hi number {i} from the second task!"); | ||
trpl::sleep(Duration::from_millis(1)).await; | ||
} | ||
}); | ||
} |
Oops, something went wrong.