-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
The implementation of abort
in #87 as detaching the task does not seem right, because detached tasks may still continue to run. Consider the following test, which should not fail but currently does.
#[test]
fn join_handle_abort_bug() {
check_dfs(
|| {
let (sender, receiver) = futures::channel::oneshot::channel();
let t = future::spawn({
async move {
receiver.await.unwrap();
panic!("should not get here");
}
});
t.abort();
sender.send(()).unwrap();
shuttle::thread::yield_now();
},
None,
);
}
(The yield_now
is needed because otherwise the main task would immediately finish, in which case also the execution finishes because there are no attached tasks left.)
We need a way to actually cancel a task, which drops its continuation and returns a JoinError
indicating cancellation.
Metadata
Metadata
Assignees
Labels
No labels