Closed
Description
Currently waking the waker by value hands over the ownership of the task to the
schedule without retaining any refcount on its own. Once the scheduling
function hands over the ownership of task further there is no guarantee that
memory that holds scheduling function will remain valid.
For example (drop(task)
is used to avoid irrelevant complexity):
fn main() {
let s = "1234".to_owned();
let (task, _) = async_task::spawn(
async {},
move |task| {
println!("{:?}", s);
drop(task);
println!("{:?}", s);
},
(),
);
task.schedule();
}
Metadata
Metadata
Assignees
Labels
No labels