Skip to content

Commit

Permalink
ARROW-12040: Addressing comments from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
westonpace committed Apr 6, 2021
1 parent d81ebc2 commit e362029
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions cpp/src/arrow/filesystem/s3fs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ struct TreeWalker : public std::enable_shared_from_this<TreeWalker> {

private:
std::shared_ptr<TaskGroup> task_group_;
util::Mutex mutex_;
std::mutex mutex_;

Status DoWalk() {
task_group_ =
Expand Down Expand Up @@ -1176,20 +1176,18 @@ struct TreeWalker : public std::enable_shared_from_this<TreeWalker> {
const auto& outcome = *result;
if (!outcome.IsSuccess()) {
{
auto guard = walker->mutex_.Lock();
std::lock_guard<std::mutex> guard(walker->mutex_);
return walker->error_handler_(outcome.GetError());
}
}
return HandleResult(outcome.GetResult());
}

void SpawnListObjectsV2() {
auto walker = this->walker;
auto req = this->req;
auto cb = *this;
walker->task_group_->Append([walker, req, cb]() mutable {
walker->task_group_->Append([cb]() mutable {
Result<S3Model::ListObjectsV2Outcome> result =
walker->client_->ListObjectsV2(req);
cb.walker->client_->ListObjectsV2(cb.req);
return cb(result);
});
}
Expand All @@ -1198,7 +1196,7 @@ struct TreeWalker : public std::enable_shared_from_this<TreeWalker> {
bool recurse;
{
// Only one thread should be running result_handler_/recursion_handler_ at a time
auto guard = walker->mutex_.Lock();
std::lock_guard<std::mutex> guard(walker->mutex_);
recurse = result.GetCommonPrefixes().size() > 0;
if (recurse) {
ARROW_ASSIGN_OR_RAISE(auto maybe_recurse,
Expand Down

0 comments on commit e362029

Please sign in to comment.