diff options
author | Feng Xiao <xfxyjwf@gmail.com> | 2018-08-08 17:14:42 -0700 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2018-08-08 17:14:42 -0700 |
commit | a8465b738e5a1f346ece58ea6f82612bcd6659d2 (patch) | |
tree | b755540a5d7d2cc988eabc7ac594e6abd9da29d1 /src/google/protobuf/stubs/mutex.h | |
parent | 6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3 (diff) | |
parent | 9bbc4b1fab8262958c172f2d8e87b486c950a051 (diff) | |
download | protobuf-a8465b738e5a1f346ece58ea6f82612bcd6659d2.tar.gz protobuf-a8465b738e5a1f346ece58ea6f82612bcd6659d2.tar.bz2 protobuf-a8465b738e5a1f346ece58ea6f82612bcd6659d2.zip |
Merge master branch.
Diffstat (limited to 'src/google/protobuf/stubs/mutex.h')
-rw-r--r-- | src/google/protobuf/stubs/mutex.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/google/protobuf/stubs/mutex.h b/src/google/protobuf/stubs/mutex.h index 47edb7a3..2b1aab87 100644 --- a/src/google/protobuf/stubs/mutex.h +++ b/src/google/protobuf/stubs/mutex.h @@ -86,12 +86,12 @@ class LIBPROTOBUF_EXPORT MutexLock { typedef MutexLock ReaderMutexLock; typedef MutexLock WriterMutexLock; -// MutexLockMaybe is like MutexLock, but is a no-op when mu is NULL. +// MutexLockMaybe is like MutexLock, but is a no-op when mu is nullptr. class LIBPROTOBUF_EXPORT MutexLockMaybe { public: explicit MutexLockMaybe(Mutex *mu) : - mu_(mu) { if (this->mu_ != NULL) { this->mu_->Lock(); } } - ~MutexLockMaybe() { if (this->mu_ != NULL) { this->mu_->Unlock(); } } + mu_(mu) { if (this->mu_ != nullptr) { this->mu_->Lock(); } } + ~MutexLockMaybe() { if (this->mu_ != nullptr) { this->mu_->Unlock(); } } private: Mutex *const mu_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MutexLockMaybe); @@ -109,7 +109,7 @@ class ThreadLocalStorage { } T* Get() { T* result = static_cast<T*>(pthread_getspecific(key_)); - if (result == NULL) { + if (result == nullptr) { result = new T(); pthread_setspecific(key_, result); } |