Automated Code Change

PiperOrigin-RevId: 794920077
Change-Id: I8f2c2ec4b8ff86de5fd6812c0225441425ea32a1
This commit is contained in:
Abseil Team
2025-08-14 01:05:24 -07:00
committed by Copybara-Service
parent 8e7767542c
commit 18ab653605
4 changed files with 10 additions and 10 deletions

View File

@@ -45,7 +45,7 @@ void ThreadOne(absl::Mutex* mutex, absl::CondVar* condvar,
CHECK(!*state) << "*state not initialized";
{
absl::MutexLock lock(mutex);
absl::MutexLock lock(*mutex);
notification->Notify();
CHECK(notification->HasBeenNotified()) << "invalid Notification";
@@ -64,7 +64,7 @@ void ThreadTwo(absl::Mutex* mutex, absl::CondVar* condvar,
notification->WaitForNotification();
CHECK(notification->HasBeenNotified()) << "invalid Notification";
{
absl::MutexLock lock(mutex);
absl::MutexLock lock(*mutex);
*state = true;
condvar->Signal();
}

View File

@@ -646,7 +646,7 @@ class ABSL_SCOPED_LOCKABLE ReaderMutexLock {
explicit ReaderMutexLock(Mutex& mu ABSL_INTERNAL_ATTRIBUTE_CAPTURED_BY(this))
ABSL_SHARED_LOCK_FUNCTION(mu)
: mu_(mu) {
mu.ReaderLock();
mu.lock_shared();
}
explicit ReaderMutexLock(Mutex* absl_nonnull mu) ABSL_SHARED_LOCK_FUNCTION(mu)
@@ -682,7 +682,7 @@ class ABSL_SCOPED_LOCKABLE WriterMutexLock {
explicit WriterMutexLock(Mutex& mu ABSL_INTERNAL_ATTRIBUTE_CAPTURED_BY(this))
ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
: mu_(mu) {
mu.WriterLock();
mu.lock();
}
explicit WriterMutexLock(Mutex* absl_nonnull mu)
@@ -705,7 +705,7 @@ class ABSL_SCOPED_LOCKABLE WriterMutexLock {
WriterMutexLock& operator=(const WriterMutexLock&) = delete;
WriterMutexLock& operator=(WriterMutexLock&&) = delete;
~WriterMutexLock() ABSL_UNLOCK_FUNCTION() { this->mu_.WriterUnlock(); }
~WriterMutexLock() ABSL_UNLOCK_FUNCTION() { this->mu_.unlock(); }
private:
Mutex& mu_;
@@ -1096,7 +1096,7 @@ class ABSL_SCOPED_LOCKABLE ReleasableMutexLock {
explicit ReleasableMutexLock(Mutex& mu ABSL_INTERNAL_ATTRIBUTE_CAPTURED_BY(
this)) ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
: mu_(&mu) {
this->mu_->Lock();
this->mu_->lock();
}
explicit ReleasableMutexLock(Mutex* absl_nonnull mu)

View File

@@ -30,7 +30,7 @@ namespace {
void BM_Mutex(benchmark::State& state) {
static absl::NoDestructor<absl::Mutex> mu;
for (auto _ : state) {
absl::MutexLock lock(mu.get());
absl::MutexLock lock(*mu.get());
}
}
BENCHMARK(BM_Mutex)->UseRealTime()->Threads(1)->ThreadPerCpu();
@@ -38,7 +38,7 @@ BENCHMARK(BM_Mutex)->UseRealTime()->Threads(1)->ThreadPerCpu();
void BM_ReaderLock(benchmark::State& state) {
static absl::NoDestructor<absl::Mutex> mu;
for (auto _ : state) {
absl::ReaderMutexLock lock(mu.get());
absl::ReaderMutexLock lock(*mu.get());
}
}
BENCHMARK(BM_ReaderLock)->UseRealTime()->Threads(1)->ThreadPerCpu();

View File

@@ -357,7 +357,7 @@ static void EndTest(int *c0, int *c1, absl::Mutex *mu, absl::CondVar *cv,
int c = (*c0)++;
mu->unlock();
cb(c);
absl::MutexLock l(mu);
absl::MutexLock l(*mu);
(*c1)++;
cv->Signal();
}
@@ -871,7 +871,7 @@ TEST(Mutex, LockedMutexDestructionBug) ABSL_NO_THREAD_SAFETY_ANALYSIS {
auto mu = absl::make_unique<absl::Mutex[]>(kNumLocks);
for (int j = 0; j != kNumLocks; j++) {
if ((j % 2) == 0) {
mu[j].WriterLock();
mu[j].lock();
} else {
mu[j].lock_shared();
}