Closed namse closed 1 month ago
If I understood correctly, this would be an issue about catching panics.
Unfortunately, unwinding the stack upon panic doesn't work on wasm32-unknown-unknown
. Therefore, we cannot expect JoinHandle
to return Err
when the spawned task has panicked. This is limitation we cannot really solve.
I'll leave a link to a detailed description:
It's not about catching panics. It's about cancellation of Future (or Poll).
https://blog.yoshuawuyts.com/async-cancellation-1/ or https://theincredibleholk.org/blog/2022/03/25/perspectives-on-async-cancellation/ would be helpful to explain.
in tokio, when we await the JoinHandle, it returns JoinResult
panic is not my interest, I only have a interest abort()
function of JoinHandle and Cancellation.
Oh I see. Indeed adding abort
to JoinHandle
would make tokio_with_wasm
more feature-complete. I will try to implement that feature myself, though there's no guarantee about when it would be done because I'm a bit busy these days. Meanwhile, this repository is open for PRs :)
This is now implemented in version 0.5.0 :D
Is it possible to impl
abort()
fn forJoinHandle<T>
? I need this feature to make a compatibility with real tokio.I have a idea that make a atomic boolean variable in JoinHandle and cancel in poll function, but I'm not sure it is enough.