Skip to content

Commit 187af2e

Browse files
authored
sync: add CancellationToken (tokio-rs#2263)
As a first step towards structured concurrency, this change adds a CancellationToken for graceful cancellation of tasks. The task can be awaited by an arbitrary amount of tasks due to the usage of an intrusive list. The token can be cloned. In addition to this child tokens can be derived. When the parent token gets cancelled, all child tokens will also get cancelled.
1 parent 31315b9 commit 187af2e

File tree

7 files changed

+2139
-0
lines changed

7 files changed

+2139
-0
lines changed

tokio/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ optional = true
123123
[dev-dependencies]
124124
tokio-test = { version = "0.2.0", path = "../tokio-test" }
125125
futures = { version = "0.3.0", features = ["async-await"] }
126+
futures-test = "0.3.0"
126127
proptest = "0.9.4"
127128
tempfile = "3.1.0"
128129

0 commit comments

Comments
 (0)