diff --git a/src/task/join_handle.rs b/src/task/join_handle.rs index 9189ea576..ced7634b2 100644 --- a/src/task/join_handle.rs +++ b/src/task/join_handle.rs @@ -78,7 +78,16 @@ impl Drop for JoinHandle { impl Future for JoinHandle { type Output = T; + #[cfg(not(target_os = "unknown"))] fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { Pin::new(&mut self.handle.as_mut().unwrap()).poll(cx) } + + #[cfg(target_arch = "wasm32")] + fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + match Pin::new(&mut self.handle.as_mut().unwrap()).poll(cx) { + Poll::Ready(Ok(value)) => Poll::Ready(value), + _ => Poll::Pending, + } + } }