TangSiyang2001 commented on code in PR #40110: URL: https://github.com/apache/arrow/pull/40110#discussion_r1497592186
########## cpp/src/arrow/filesystem/s3fs.cc: ########## @@ -3004,6 +3004,8 @@ Status InitializeS3(const S3GlobalOptions& options) { } Status EnsureS3Initialized() { + static std::mutex init_mutex; + std::lock_guard<std::mutex> l(init_mutex); Review Comment: > Why not put this in `AwsInstance`? Thanks for your reviewing @pitrou! Cuz only `EnsureS3Initialized()` will be called implicitly by `FileSystemFromUri`, I guess it was also the reason why @kou suggested to put it here in the former comment. However, put this in `AwsInstance` does actually make it more uniformed. > Also, note that the idiomatic way of doing this would be https://en.cppreference.com/w/cpp/thread/call_once , but it probably does not matter much. Yes it better to use `std::call_once` here, I'll change it to that way. -- 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...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org