mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-25 00:00:18 +02:00
task: improve JoinHandle::abort cancellation doc (#4121)
This commit is contained in:
@@ -162,7 +162,7 @@ impl<T> JoinHandle<T> {
|
|||||||
///
|
///
|
||||||
/// Awaiting a cancelled task might complete as usual if the task was
|
/// Awaiting a cancelled task might complete as usual if the task was
|
||||||
/// already completed at the time it was cancelled, but most likely it
|
/// already completed at the time it was cancelled, but most likely it
|
||||||
/// will complete with a `Err(JoinError::Cancelled)`.
|
/// will fail with a [cancelled] `JoinError`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use tokio::time;
|
/// use tokio::time;
|
||||||
@@ -190,6 +190,7 @@ impl<T> JoinHandle<T> {
|
|||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
/// [cancelled]: method@super::error::JoinError::is_cancelled
|
||||||
pub fn abort(&self) {
|
pub fn abort(&self) {
|
||||||
if let Some(raw) = self.raw {
|
if let Some(raw) = self.raw {
|
||||||
raw.remote_abort();
|
raw.remote_abort();
|
||||||
|
|||||||
Reference in New Issue
Block a user