Skip to content

Commit 9b74448

Browse files
authored
clean-up: use mutex reference p3 (#42674)
Replace deprecated absl::MutexLock::MutexLock(Mutex*) constructor with absl::MutexLock::MutexLock(Mutex&) Similar to #41208. Commit Message: Additional Description: Risk Level: Testing: Docs Changes: Release Notes: Signed-off-by: Boteng Yao <boteng@google.com>
1 parent 8b1f88d commit 9b74448

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

source/extensions/clusters/redis/redis_cluster_lb.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ bool RedisClusterLoadBalancerFactory::onClusterSlotUpdate(ClusterSlotsSharedPtr&
6868
}
6969

7070
{
71-
absl::WriterMutexLock lock(&mutex_);
71+
absl::WriterMutexLock lock(mutex_);
7272
current_cluster_slot_ = std::move(slots);
7373
slot_array_ = std::move(updated_slots);
7474
shard_vector_ = std::move(shard_vector);
@@ -96,7 +96,7 @@ void RedisClusterLoadBalancerFactory::onHostHealthUpdate() {
9696
}
9797

9898
{
99-
absl::WriterMutexLock lock(&mutex_);
99+
absl::WriterMutexLock lock(mutex_);
100100
shard_vector_ = std::move(shard_vector);
101101
}
102102
}

source/extensions/http/cache/simple_http_cache/simple_http_cache.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ void SimpleHttpCache::updateHeaders(const LookupContext& lookup_context,
178178
UpdateHeadersCallback on_complete) {
179179
const auto& simple_lookup_context = static_cast<const SimpleLookupContext&>(lookup_context);
180180
const Key& key = simple_lookup_context.request().key();
181-
absl::WriterMutexLock lock(&mutex_);
181+
absl::WriterMutexLock lock(mutex_);
182182
auto iter = map_.find(key);
183183
auto post_complete = [on_complete = std::move(on_complete),
184184
&dispatcher = simple_lookup_context.dispatcher()](bool result) mutable {
@@ -234,7 +234,7 @@ SimpleHttpCache::Entry SimpleHttpCache::lookup(const LookupRequest& request) {
234234
bool SimpleHttpCache::insert(const Key& key, Http::ResponseHeaderMapPtr&& response_headers,
235235
ResponseMetadata&& metadata, std::string&& body,
236236
Http::ResponseTrailerMapPtr&& trailers) {
237-
absl::WriterMutexLock lock(&mutex_);
237+
absl::WriterMutexLock lock(mutex_);
238238
map_[key] = SimpleHttpCache::Entry{std::move(response_headers), std::move(metadata),
239239
std::move(body), std::move(trailers)};
240240
return true;
@@ -273,7 +273,7 @@ bool SimpleHttpCache::varyInsert(const Key& request_key,
273273
const Http::RequestHeaderMap& request_headers,
274274
const VaryAllowList& vary_allow_list,
275275
Http::ResponseTrailerMapPtr&& trailers) {
276-
absl::WriterMutexLock lock(&mutex_);
276+
absl::WriterMutexLock lock(mutex_);
277277

278278
absl::btree_set<absl::string_view> vary_header_values =
279279
VaryHeaderUtils::getVaryValues(*response_headers);

test/common/access_log/access_log_manager_impl_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ TEST_F(AccessLogManagerImplTest, FlushToLogFileOnDemand) {
188188
log_file->write("test");
189189

190190
{
191-
absl::MutexLock lock(&file_->mutex_);
191+
absl::MutexLock lock(file_->mutex_);
192192
EXPECT_EQ(expected_writes, file_->num_writes_);
193193
}
194194

test/extensions/geoip_providers/maxmind/geoip_provider_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class GeoipProviderTestBase {
140140
}
141141

142142
~GeoipProviderTestBase() {
143-
absl::WriterMutexLock lock(&mutex_);
143+
absl::WriterMutexLock lock(mutex_);
144144
on_changed_cbs_.clear();
145145
};
146146

@@ -157,7 +157,7 @@ class GeoipProviderTestBase {
157157
.WillRepeatedly(Invoke([this, &conditional](absl::string_view, uint32_t,
158158
Filesystem::Watcher::OnChangedCb cb) {
159159
{
160-
absl::WriterMutexLock lock(&mutex_);
160+
absl::WriterMutexLock lock(mutex_);
161161
on_changed_cbs_.reserve(1);
162162
on_changed_cbs_.emplace_back(std::move(cb));
163163
}

0 commit comments

Comments
 (0)