diff options
author | Abseil Team <absl-team@google.com> | 2018-04-11T16·52-0700 |
---|---|---|
committer | Matt Calabrese <calabrese@x.team> | 2018-04-11T17·39-0400 |
commit | a7e522daf1ec9cda69b356472f662142dd0c1215 (patch) | |
tree | 3412b9092fb7b3982035f10a3bb1bdaaceeda9f2 /absl/synchronization/mutex.h | |
parent | 475d64f2de7403a01b1b36c487328ed41d29c20c (diff) |
- a0673e81da7ee7e322283e518331a4cdaeca837b Internal change by Abseil Team <absl-team@google.com>
- 537e863510a423968c2d319263dd1c100695a2e9 Add internal-only functionality to examine the stack, to ... by Derek Mauro <dmauro@google.com> - 1ded12406d8b8fd7be910c8dfe8c2a8edf66136e Explicitly suppress the default move constructor and assi... by Derek Mauro <dmauro@google.com> - 347d38447ebc38e5d33fec6b67988880eb3cd249 Move implementation detail do_mmap64 to a new file. by Greg Falcon <gfalcon@google.com> GitOrigin-RevId: a0673e81da7ee7e322283e518331a4cdaeca837b Change-Id: I5a347d34d5173082b3a78eb53432481b32c94b69
Diffstat (limited to 'absl/synchronization/mutex.h')
-rw-r--r-- | absl/synchronization/mutex.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/absl/synchronization/mutex.h b/absl/synchronization/mutex.h index 9301222e0218..c4e026f9b936 100644 --- a/absl/synchronization/mutex.h +++ b/absl/synchronization/mutex.h @@ -519,11 +519,16 @@ class SCOPED_LOCKABLE MutexLock { explicit MutexLock(Mutex *mu) EXCLUSIVE_LOCK_FUNCTION(mu) : mu_(mu) { this->mu_->Lock(); } + + MutexLock(const MutexLock &) = delete; // NOLINT(runtime/mutex) + MutexLock(MutexLock&&) = delete; // NOLINT(runtime/mutex) + MutexLock& operator=(const MutexLock&) = delete; + MutexLock& operator=(MutexLock&&) = delete; + ~MutexLock() UNLOCK_FUNCTION() { this->mu_->Unlock(); } + private: Mutex *const mu_; - MutexLock(const MutexLock &) = delete; // NOLINT(runtime/mutex) - MutexLock& operator=(const MutexLock&) = delete; }; // ReaderMutexLock @@ -536,13 +541,18 @@ class SCOPED_LOCKABLE ReaderMutexLock { : mu_(mu) { mu->ReaderLock(); } + + ReaderMutexLock(const ReaderMutexLock&) = delete; + ReaderMutexLock(ReaderMutexLock&&) = delete; + ReaderMutexLock& operator=(const ReaderMutexLock&) = delete; + ReaderMutexLock& operator=(ReaderMutexLock&&) = delete; + ~ReaderMutexLock() UNLOCK_FUNCTION() { this->mu_->ReaderUnlock(); } + private: Mutex *const mu_; - ReaderMutexLock(const ReaderMutexLock&) = delete; - ReaderMutexLock& operator=(const ReaderMutexLock&) = delete; }; // WriterMutexLock @@ -555,13 +565,18 @@ class SCOPED_LOCKABLE WriterMutexLock { : mu_(mu) { mu->WriterLock(); } + + WriterMutexLock(const WriterMutexLock&) = delete; + WriterMutexLock(WriterMutexLock&&) = delete; + WriterMutexLock& operator=(const WriterMutexLock&) = delete; + WriterMutexLock& operator=(WriterMutexLock&&) = delete; + ~WriterMutexLock() UNLOCK_FUNCTION() { this->mu_->WriterUnlock(); } + private: Mutex *const mu_; - WriterMutexLock(const WriterMutexLock&) = delete; - WriterMutexLock& operator=(const WriterMutexLock&) = delete; }; // ----------------------------------------------------------------------------- @@ -834,7 +849,9 @@ class SCOPED_LOCKABLE MutexLockMaybe { private: Mutex *const mu_; MutexLockMaybe(const MutexLockMaybe&) = delete; + MutexLockMaybe(MutexLockMaybe&&) = delete; MutexLockMaybe& operator=(const MutexLockMaybe&) = delete; + MutexLockMaybe& operator=(MutexLockMaybe&&) = delete; }; // ReleaseableMutexLock @@ -856,7 +873,9 @@ class SCOPED_LOCKABLE ReleasableMutexLock { private: Mutex *mu_; ReleasableMutexLock(const ReleasableMutexLock&) = delete; + ReleasableMutexLock(ReleasableMutexLock&&) = delete; ReleasableMutexLock& operator=(const ReleasableMutexLock&) = delete; + ReleasableMutexLock& operator=(ReleasableMutexLock&&) = delete; }; #ifdef ABSL_INTERNAL_USE_NONPROD_MUTEX |