Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cpp/array_record_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class ArrayRecordWriterBase::SubmitChunkCallback
// return false if we can't schedule the callback.
// return true and inc num_concurrent_chunk_writers if we can add a new one.
bool TrackConcurrentChunkWriters() {
absl::MutexLock l(&mu_);
absl::MutexLock l(mu_);
if (num_concurrent_chunk_writers_ >= max_parallelism_) {
return false;
}
Expand Down Expand Up @@ -495,7 +495,7 @@ void ArrayRecordWriterBase::SubmitChunkCallback::operator()(
footer.set_num_records(num_records);
array_footer_.push_back(std::move(footer));

absl::MutexLock l(&mu_);
absl::MutexLock l(mu_);
num_concurrent_chunk_writers_--;
}

Expand Down
8 changes: 4 additions & 4 deletions cpp/sequenced_chunk_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace array_record {

bool SequencedChunkWriterBase::CommitFutureChunk(
std::future<absl::StatusOr<riegeli::Chunk>>&& future_chunk) {
absl::MutexLock l(&mu_);
absl::MutexLock l(mu_);
if (!ok()) {
return false;
}
Expand Down Expand Up @@ -64,13 +64,13 @@ bool SequencedChunkWriterBase::SubmitFutureChunks(bool block) {
if (block) {
// When blocking, we block both on mutex acquisition and on future
// completion.
absl::MutexLock lock(&mu_);
absl::MutexLock lock(mu_);
riegeli::ChunkWriter* writer = get_writer();
while (!queue_.empty()) {
TrySubmitFirstFutureChunk(writer);
}
return ok();
} else if (mu_.TryLock()) {
} else if (mu_.try_lock()) {
// When non-blocking, we only proceed if we can lock the mutex without
// blocking, and we only process those futures that are ready. We need
// to unlock the mutex manually in this case, and take care to call ok()
Expand All @@ -82,7 +82,7 @@ bool SequencedChunkWriterBase::SubmitFutureChunks(bool block) {
TrySubmitFirstFutureChunk(writer);
}
bool result = ok();
mu_.Unlock();
mu_.unlock();
return result;
} else {
return true;
Expand Down
Loading