mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 12:07:05 +08:00
Automated Code Change
PiperOrigin-RevId: 794920077 Change-Id: I8f2c2ec4b8ff86de5fd6812c0225441425ea32a1
This commit is contained in:
committed by
Copybara-Service
parent
8e7767542c
commit
18ab653605
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user