@@ -612,12 +612,16 @@ class ABSL_SCOPED_LOCKABLE MutexLock {
612612 // Like above, but calls `mu->LockWhen(cond)` instead. That is, in addition to
613613 // the above, the condition given by `cond` is also guaranteed to hold when
614614 // this object is constructed.
615- explicit MutexLock (Mutex* absl_nonnull mu, const Condition& cond)
615+ explicit MutexLock (Mutex& mu, const Condition& cond)
616616 ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
617- : mu_(* mu) {
617+ : mu_(mu) {
618618 this ->mu_ .LockWhen (cond);
619619 }
620620
621+ explicit MutexLock (Mutex* absl_nonnull mu, const Condition& cond)
622+ ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
623+ : MutexLock(*mu, cond) {}
624+
621625 MutexLock (const MutexLock&) = delete ; // NOLINT(runtime/mutex)
622626 MutexLock (MutexLock&&) = delete ; // NOLINT(runtime/mutex)
623627 MutexLock& operator =(const MutexLock&) = delete ;
@@ -1081,18 +1085,25 @@ class ABSL_SCOPED_LOCKABLE MutexLockMaybe {
10811085// mutex before destruction. `Release()` may be called at most once.
10821086class ABSL_SCOPED_LOCKABLE ReleasableMutexLock {
10831087 public:
1088+ explicit ReleasableMutexLock (Mutex& mu) ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
1089+ : mu_(&mu) {
1090+ this ->mu_ ->Lock ();
1091+ }
1092+
10841093 explicit ReleasableMutexLock (Mutex* absl_nonnull mu)
10851094 ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
1086- : mu_(mu) {
1087- this ->mu_ ->lock ();
1088- }
1095+ : ReleasableMutexLock(*mu) {}
10891096
1090- explicit ReleasableMutexLock (Mutex* absl_nonnull mu, const Condition& cond)
1097+ explicit ReleasableMutexLock (Mutex& mu, const Condition& cond)
10911098 ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
1092- : mu_(mu) {
1099+ : mu_(& mu) {
10931100 this ->mu_ ->LockWhen (cond);
10941101 }
10951102
1103+ explicit ReleasableMutexLock (Mutex* absl_nonnull mu, const Condition& cond)
1104+ ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
1105+ : ReleasableMutexLock(*mu, cond) {}
1106+
10961107 ~ReleasableMutexLock () ABSL_UNLOCK_FUNCTION () {
10971108 if (this ->mu_ != nullptr ) {
10981109 this ->mu_ ->unlock ();
0 commit comments