Skip to content

Commit 9df216c

Browse files
derekmaurocopybara-github
authored andcommitted
Update spelling of Mutex::lock and Mutex::unlock for compatibility
with the standard and the latest Abseil PiperOrigin-RevId: 806260850 Change-Id: Ie973be4a3aaf7e174cd692ce6df7a82c8f261bf7
1 parent 7917641 commit 9df216c

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

googlemock/include/gmock/gmock-spec-builders.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,15 +1530,15 @@ class FunctionMocker<R(Args...)> final : public UntypedFunctionMockerBase {
15301530
UntypedOnCallSpecs specs_to_delete;
15311531
untyped_on_call_specs_.swap(specs_to_delete);
15321532

1533-
g_gmock_mutex.Unlock();
1533+
g_gmock_mutex.unlock();
15341534
for (UntypedOnCallSpecs::const_iterator it = specs_to_delete.begin();
15351535
it != specs_to_delete.end(); ++it) {
15361536
delete static_cast<const OnCallSpec<F>*>(*it);
15371537
}
15381538

15391539
// Lock the mutex again, since the caller expects it to be locked when we
15401540
// return.
1541-
g_gmock_mutex.Lock();
1541+
g_gmock_mutex.lock();
15421542
}
15431543

15441544
// Returns the result of invoking this mock function with the given

googlemock/src/gmock-spec-builders.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,9 @@ bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked()
436436
UntypedExpectations expectations_to_delete;
437437
untyped_expectations_.swap(expectations_to_delete);
438438

439-
g_gmock_mutex.Unlock();
439+
g_gmock_mutex.unlock();
440440
expectations_to_delete.clear();
441-
g_gmock_mutex.Lock();
441+
g_gmock_mutex.lock();
442442

443443
return expectations_met;
444444
}

googletest/include/gtest/internal/gtest-port.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,9 +1385,9 @@ class GTEST_API_ Mutex {
13851385
Mutex();
13861386
~Mutex();
13871387

1388-
void Lock();
1388+
void lock();
13891389

1390-
void Unlock();
1390+
void unlock();
13911391

13921392
// Does nothing if the current thread holds the mutex. Otherwise, crashes
13931393
// with high probability.
@@ -1424,9 +1424,9 @@ class GTEST_API_ Mutex {
14241424
// "MutexLock l(&mu)". Hence the typedef trick below.
14251425
class GTestMutexLock {
14261426
public:
1427-
explicit GTestMutexLock(Mutex* mutex) : mutex_(mutex) { mutex_->Lock(); }
1427+
explicit GTestMutexLock(Mutex* mutex) : mutex_(mutex) { mutex_->lock(); }
14281428

1429-
~GTestMutexLock() { mutex_->Unlock(); }
1429+
~GTestMutexLock() { mutex_->unlock(); }
14301430

14311431
private:
14321432
Mutex* const mutex_;
@@ -1641,14 +1641,14 @@ class ThreadLocal : public ThreadLocalBase {
16411641
class MutexBase {
16421642
public:
16431643
// Acquires this mutex.
1644-
void Lock() {
1644+
void lock() {
16451645
GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
16461646
owner_ = pthread_self();
16471647
has_owner_ = true;
16481648
}
16491649

16501650
// Releases this mutex.
1651-
void Unlock() {
1651+
void unlock() {
16521652
// Since the lock is being released the owner_ field should no longer be
16531653
// considered valid. We don't protect writing to has_owner_ here, as it's
16541654
// the caller's responsibility to ensure that the current thread holds the
@@ -1716,9 +1716,9 @@ class Mutex : public MutexBase {
17161716
// "MutexLock l(&mu)". Hence the typedef trick below.
17171717
class GTestMutexLock {
17181718
public:
1719-
explicit GTestMutexLock(MutexBase* mutex) : mutex_(mutex) { mutex_->Lock(); }
1719+
explicit GTestMutexLock(MutexBase* mutex) : mutex_(mutex) { mutex_->lock(); }
17201720

1721-
~GTestMutexLock() { mutex_->Unlock(); }
1721+
~GTestMutexLock() { mutex_->unlock(); }
17221722

17231723
private:
17241724
MutexBase* const mutex_;
@@ -1864,8 +1864,8 @@ class GTEST_API_ ThreadLocal {
18641864
class Mutex {
18651865
public:
18661866
Mutex() {}
1867-
void Lock() {}
1868-
void Unlock() {}
1867+
void lock() {}
1868+
void unlock() {}
18691869
void AssertHeld() const {}
18701870
};
18711871

googletest/src/gtest-port.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,13 +320,13 @@ Mutex::~Mutex() {
320320
}
321321
}
322322

323-
void Mutex::Lock() {
323+
void Mutex::lock() {
324324
ThreadSafeLazyInit();
325325
::EnterCriticalSection(critical_section_);
326326
owner_thread_id_ = ::GetCurrentThreadId();
327327
}
328328

329-
void Mutex::Unlock() {
329+
void Mutex::unlock() {
330330
ThreadSafeLazyInit();
331331
// We don't protect writing to owner_thread_id_ here, as it's the
332332
// caller's responsibility to ensure that the current thread holds the

googletest/test/googletest-port-test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ TEST(FormatCompilerIndependentFileLocationTest, FormatsUknownFileAndLine) {
288288
defined(GTEST_OS_OPENBSD) || defined(GTEST_OS_GNU_HURD)
289289
void* ThreadFunc(void* data) {
290290
internal::Mutex* mutex = static_cast<internal::Mutex*>(data);
291-
mutex->Lock();
292-
mutex->Unlock();
291+
mutex->lock();
292+
mutex->unlock();
293293
return nullptr;
294294
}
295295

0 commit comments

Comments
 (0)