-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
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
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 @@ | ||
# Procedural | ||
|
||
A Future (tree) is procedural. | ||
|
||
Externally, as a whole, a Future is "single-threaded" -- at any given time, a | ||
Future should be polled in *one* thread. | ||
|
||
Internally, as a tree of Futures, the Futures involved in the "current external | ||
poll" should be polled *one by one*, in the given thread. |
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,19 @@ | ||
# Task | ||
|
||
## Internally | ||
|
||
Runtimes use Tasks internally to manage Futures. A Task is an object which | ||
contains a Future and "everything else" needed to manage the Future. | ||
|
||
|
||
## Externally | ||
|
||
While "Task" is internal to a runtime, knowing that it exists can help us | ||
understand the runtimes better, and thus use them well. | ||
|
||
Like a Future, a Task is also [procedural](../composing/procedural.md). To have | ||
Futures polled in a "multi-threaded" way, they must be spawned (see | ||
[smol::spawn][1] or [tokio::task::spawn][2]). | ||
|
||
[1]: https://docs.rs/smol/latest/smol/fn.spawn.html | ||
[2]: https://docs.rs/tokio/latest/tokio/task/fn.spawn.html |