alamb commented on code in PR #16883:
URL: https://github.com/apache/datafusion/pull/16883#discussion_r2228155310
##########
datafusion/common-runtime/src/common.rs:
##########
@@ -82,6 +82,23 @@ impl<R: 'static> SpawnedTask<R> {
}
})
}
+
+ /// Joins the task using a mutable reference and unwinds the panic if it
happens.
Review Comment:
Could you also document what happens if `join_unwind_mut` is called twice on
the same task?
##########
datafusion/common-runtime/src/common.rs:
##########
@@ -82,6 +82,23 @@ impl<R: 'static> SpawnedTask<R> {
}
})
}
+
+ /// Joins the task using a mutable reference and unwinds the panic if it
happens.
+ ///
+ /// This method is similar to [`join_unwind`](Self::join_unwind), but
takes a mutable
+ /// reference instead of consuming `self`. This allows the `SpawnedTask`
to remain
+ /// usable after the call, though once a task completes, subsequent calls
will continue
+ /// to return the same `JoinError`.
+ pub async fn join_unwind_mut(&mut self) -> Result<R, JoinError> {
+ self.await.map_err(|e| {
Review Comment:
To avoid code duplication, perhaps we could change `join_unwind` to call
`join_unwind_mut` ?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]