swanandx commented on code in PR #3277:
URL: https://github.com/apache/iceberg-rust/pull/3277#discussion_r4367549555


##########
crates/iceberg/src/runtime/mod.rs:
##########
@@ -48,6 +55,29 @@ impl<T: Send + 'static> Future for JoinHandle<T> {
     }
 }
 
+/// A [`JoinHandle`] that aborts its task when dropped.
+///
+/// Dropping a plain `JoinHandle` detaches the task, which then runs on with
+/// nobody waiting for its result. Use this instead wherever the result is
+/// private to the caller, so that dropping the caller stops the work.
+pub(crate) struct AbortOnDropHandle<T>(JoinHandle<T>);
+
+impl<T> Drop for AbortOnDropHandle<T> {
+    fn drop(&mut self) {
+        self.0.0.abort();
+    }
+}
+
+impl<T> Unpin for AbortOnDropHandle<T> {}

Review Comment:
   thanks for catching this



-- 
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]

Reply via email to