alamb commented on code in PR #9422:
URL: https://github.com/apache/arrow-datafusion/pull/9422#discussion_r1510006631
##########
datafusion/common_runtime/src/common.rs:
##########
@@ -51,10 +51,22 @@ impl<R: 'static> SpawnedTask<R> {
Self { inner }
}
+ /// Joins the task, returning the result of join (`Result<R, JoinError>`).
pub async fn join(mut self) -> Result<R, JoinError> {
self.inner
.join_next()
.await
.expect("`SpawnedTask` instance always contains exactly 1 task")
}
+
+ /// Joins the task and unwinds the panic if it happens.
+ pub async fn join_unwind(self) -> R {
+ self.join().await.unwrap_or_else(|e| {
+ if e.is_panic() {
+ std::panic::resume_unwind(e.into_panic());
+ } else {
+ unreachable!();
Review Comment:
whi is this unreachable? Is there no other way for a Task::join to error?
##########
datafusion/common_runtime/src/common.rs:
##########
@@ -51,10 +51,22 @@ impl<R: 'static> SpawnedTask<R> {
Self { inner }
}
+ /// Joins the task, returning the result of join (`Result<R, JoinError>`).
pub async fn join(mut self) -> Result<R, JoinError> {
self.inner
.join_next()
.await
.expect("`SpawnedTask` instance always contains exactly 1 task")
}
+
+ /// Joins the task and unwinds the panic if it happens.
Review Comment:
👍
--
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]