ashdnazg commented on code in PR #15653: URL: https://github.com/apache/datafusion/pull/15653#discussion_r2036184085
########## datafusion/common-runtime/src/common.rs: ########## @@ -77,17 +82,32 @@ impl<R: 'static> SpawnedTask<R> { } } +impl<R> Future for SpawnedTask<R> { + type Output = Result<R, JoinError>; + + fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { + Pin::new(&mut self.inner).poll(cx) + } +} + +impl<R> Drop for SpawnedTask<R> { + fn drop(&mut self) { + self.inner.abort(); + } +} + #[cfg(test)] mod tests { use super::*; use std::future::{pending, Pending}; - use tokio::runtime::Runtime; + use tokio::{runtime::Runtime, sync::oneshot}; #[tokio::test] async fn runtime_shutdown() { let rt = Runtime::new().unwrap(); + #[allow(clippy::async_yields_async)] Review Comment: If you want, I can change the `rt.spawn` to `rt.spawn_blocking` and then we get rid of both the unnecessary surrounding `async` and the clippy thing. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org