mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-08 00:00:13 +02:00
sync: improve CancellationToken doc on child tokens (#5632)
This commit is contained in:
@@ -97,6 +97,8 @@ impl core::fmt::Debug for CancellationToken {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Clone for CancellationToken {
|
impl Clone for CancellationToken {
|
||||||
|
/// Creates a clone of the `CancellationToken` which will get cancelled
|
||||||
|
/// whenever the current token gets cancelled, and vice versa.
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
tree_node::increase_handle_refcount(&self.inner);
|
tree_node::increase_handle_refcount(&self.inner);
|
||||||
CancellationToken {
|
CancellationToken {
|
||||||
@@ -126,7 +128,8 @@ impl CancellationToken {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a `CancellationToken` which will get cancelled whenever the
|
/// Creates a `CancellationToken` which will get cancelled whenever the
|
||||||
/// current token gets cancelled.
|
/// current token gets cancelled. Unlike a cloned `CancellationToken`,
|
||||||
|
/// cancelling a child token does not cancel the parent token.
|
||||||
///
|
///
|
||||||
/// If the current token is already cancelled, the child token will get
|
/// If the current token is already cancelled, the child token will get
|
||||||
/// returned in cancelled state.
|
/// returned in cancelled state.
|
||||||
|
|||||||
Reference in New Issue
Block a user