smol-rs/async-task

How to join the task when task sets detached?

ethe opened this issue · 2 comments

ethe commented

Task::detach does not have a return, but Task::set_detached does, is it able to get the task output by Task::detach?

set_detached will only return a value if the task has already been completed.

I guess that it is probably preferable to use a (oneshot) channel and send the results, in your use case.

ethe commented

Thanks, I will try to use an approach of oneshot channel.