@@ -933,11 +933,25 @@ implementation.
933
933
MutexLocker(Mutex *mu, defer_lock_t) EXCLUDES(mu) : mut(mu), locked(false) {}
934
934
935
935
// Same as constructors, but without tag types. (Requires C++17 copy elision.)
936
- static MutexLocker Lock(Mutex *mu) ACQUIRE(mu);
937
- static MutexLocker Adopt(Mutex *mu) REQUIRES(mu);
938
- static MutexLocker ReaderLock(Mutex *mu) ACQUIRE_SHARED(mu);
939
- static MutexLocker AdoptReaderLock(Mutex *mu) REQUIRES_SHARED(mu);
940
- static MutexLocker DeferLock(Mutex *mu) EXCLUDES(mu);
936
+ static MutexLocker Lock(Mutex *mu) ACQUIRE(mu) {
937
+ return MutexLocker(mu);
938
+ }
939
+
940
+ static MutexLocker Adopt(Mutex *mu) REQUIRES(mu) {
941
+ return MutexLocker(mu, adopt_lock);
942
+ }
943
+
944
+ static MutexLocker ReaderLock(Mutex *mu) ACQUIRE_SHARED(mu) {
945
+ return MutexLocker(mu, shared_lock);
946
+ }
947
+
948
+ static MutexLocker AdoptReaderLock(Mutex *mu) REQUIRES_SHARED(mu) {
949
+ return MutexLocker(mu, adopt_lock, shared_lock);
950
+ }
951
+
952
+ static MutexLocker DeferLock(Mutex *mu) EXCLUDES(mu) {
953
+ return MutexLocker(mu, defer_lock);
954
+ }
941
955
942
956
// Release *this and all associated mutexes, if they are still held.
943
957
// There is no warning if the scope was already unlocked before.
0 commit comments