Skip to content

Commit befccf0

Browse files
committed
fix current_thread runtime error
1 parent fd2b09e commit befccf0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tokio/src/runtime/task/join.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ impl<T> JoinHandle<T> {
182182
/// ```rust
183183
/// use tokio::time;
184184
///
185-
/// #[tokio::main]
186-
/// async fn main() {
185+
/// # #[tokio::main(flavor = "current_thread")]
186+
/// # async fn main() {
187187
/// # tokio::time::pause();
188188
/// let mut handles = Vec::new();
189189
///
@@ -204,7 +204,7 @@ impl<T> JoinHandle<T> {
204204
/// for handle in handles {
205205
/// assert!(handle.await.unwrap_err().is_cancelled());
206206
/// }
207-
/// }
207+
/// # }
208208
/// ```
209209
/// [cancelled]: method@super::error::JoinError::is_cancelled
210210
pub fn abort(&self) {
@@ -261,9 +261,9 @@ impl<T> JoinHandle<T> {
261261
/// ```rust
262262
/// use tokio::{time, task};
263263
///
264-
/// #[tokio::main]
265-
/// async fn main() {
266-
/// # tokio::time::pause();
264+
/// # #[tokio::main(flavor = "current_thread")]
265+
/// # async fn main() {
266+
/// # time::pause();
267267
/// let mut handles = Vec::new();
268268
///
269269
/// handles.push(tokio::spawn(async {
@@ -285,7 +285,7 @@ impl<T> JoinHandle<T> {
285285
/// for handle in handles {
286286
/// assert!(handle.await.unwrap_err().is_cancelled());
287287
/// }
288-
/// }
288+
/// # }
289289
/// ```
290290
/// [cancelled]: method@super::error::JoinError::is_cancelled
291291
pub fn abort_handle(&self) -> super::AbortHandle {

0 commit comments

Comments
 (0)