Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Alice Ryhl <alice@ryhl.io>
  • Loading branch information
udoprog and Darksonn committed Apr 4, 2021
1 parent 119a854 commit 67ccbf9
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions tokio/tests/task_abort.rs
Expand Up @@ -43,7 +43,6 @@ fn test_abort_without_panic_3662() {
}

let rt = tokio::runtime::Builder::new_current_thread()
.worker_threads(1)
.build()
.unwrap();

Expand All @@ -55,12 +54,12 @@ fn test_abort_without_panic_3662() {
// NB: just grab the drop check here so that it becomes part of the
// task.
let _drop_check = drop_check;
futures::future::pending::<()>().await;
std::future::pending::<()>().await;
});

let drop_flag2 = drop_flag.clone();

let task = tokio::task::spawn_blocking(move || {
let task = std::thread::spawn(move || {
// This runs in a separate thread so it doesn't have immediate
// thread-local access to the executor. It does however transition
// the underlying task to be completed, which will cause it to be
Expand All @@ -87,16 +86,7 @@ fn test_abort_without_panic_3662() {
// so that the scheduler can go into the "auxilliary tasks" mode, at
// which point the task is removed from the scheduler.
let i = tokio::spawn(async move {
let mut first = true;

let task = futures::future::poll_fn(|cx| {
if std::mem::take(&mut first) {
cx.waker().wake_by_ref();
Poll::Pending
} else {
Poll::Ready(())
}
});
tokio::task::yield_now().await;

task.await;
});
Expand Down

0 comments on commit 67ccbf9

Please sign in to comment.