mapleFU commented on code in PR #41232:
URL: https://github.com/apache/arrow/pull/41232#discussion_r1568138756


##########
cpp/src/arrow/filesystem/gcsfs.cc:
##########
@@ -200,6 +201,16 @@ class GcsOutputStream : public arrow::io::OutputStream {
     return internal::ToArrowStatus(stream_.last_status());
   }
 
+  Future<> CloseAsync() override {
+    if (closed_) return Status::OK();
+
+    auto self = std::dynamic_pointer_cast<GcsOutputStream>(shared_from_this());
+    auto deferred = [self = std::move(self)]() -> Status { return 
self->Close(); };

Review Comment:
   🤔 A called flag or a `Future<>` can be ok here. If `CloseAsync/Close` not 
being called after current `CloseAsync` it could be safe. Checking 
`shared_from_this()` is a bit hacking to be, think about something like 
Compressed Output Stream, which capture a stream as reference.



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

Reply via email to