diff options
author | Mathieu Chartier <mathieuc@google.com> | 2015-04-21 16:50:40 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2015-04-22 12:44:27 -0700 |
commit | 2cebb24bfc3247d3e9be138a3350106737455918 (patch) | |
tree | d04d27d21b3c7733d784e303f01f873bb99e7770 /runtime/base/mutex-inl.h | |
parent | 1f02f1a7b3073b8fef07770a67fbf94afad317f0 (diff) | |
download | art-2cebb24bfc3247d3e9be138a3350106737455918.zip art-2cebb24bfc3247d3e9be138a3350106737455918.tar.gz art-2cebb24bfc3247d3e9be138a3350106737455918.tar.bz2 |
Replace NULL with nullptr
Also fixed some lines that were too long, and a few other minor
details.
Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
Diffstat (limited to 'runtime/base/mutex-inl.h')
-rw-r--r-- | runtime/base/mutex-inl.h | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/runtime/base/mutex-inl.h b/runtime/base/mutex-inl.h index cb69817..a727992 100644 --- a/runtime/base/mutex-inl.h +++ b/runtime/base/mutex-inl.h @@ -39,13 +39,14 @@ namespace art { #if ART_USE_FUTEXES -static inline int futex(volatile int *uaddr, int op, int val, const struct timespec *timeout, volatile int *uaddr2, int val3) { +static inline int futex(volatile int *uaddr, int op, int val, const struct timespec *timeout, + volatile int *uaddr2, int val3) { return syscall(SYS_futex, uaddr, op, val, timeout, uaddr2, val3); } #endif // ART_USE_FUTEXES static inline uint64_t SafeGetTid(const Thread* self) { - if (self != NULL) { + if (self != nullptr) { return static_cast<uint64_t>(self->GetTid()); } else { return static_cast<uint64_t>(GetTid()); @@ -77,7 +78,7 @@ static inline void CheckUnattachedThread(LockLevel level) NO_THREAD_SAFETY_ANALY } inline void BaseMutex::RegisterAsLocked(Thread* self) { - if (UNLIKELY(self == NULL)) { + if (UNLIKELY(self == nullptr)) { CheckUnattachedThread(level_); return; } @@ -86,7 +87,7 @@ inline void BaseMutex::RegisterAsLocked(Thread* self) { bool bad_mutexes_held = false; for (int i = level_; i >= 0; --i) { BaseMutex* held_mutex = self->GetHeldMutex(static_cast<LockLevel>(i)); - if (UNLIKELY(held_mutex != NULL)) { + if (UNLIKELY(held_mutex != nullptr)) { LOG(ERROR) << "Lock level violation: holding \"" << held_mutex->name_ << "\" " << "(level " << LockLevel(i) << " - " << i << ") while locking \"" << name_ << "\" " @@ -109,7 +110,7 @@ inline void BaseMutex::RegisterAsLocked(Thread* self) { } inline void BaseMutex::RegisterAsUnlocked(Thread* self) { - if (UNLIKELY(self == NULL)) { + if (UNLIKELY(self == nullptr)) { CheckUnattachedThread(level_); return; } @@ -117,12 +118,12 @@ inline void BaseMutex::RegisterAsUnlocked(Thread* self) { if (kDebugLocking && gAborting == 0) { // Avoid recursive aborts. CHECK(self->GetHeldMutex(level_) == this) << "Unlocking on unacquired mutex: " << name_; } - self->SetHeldMutex(level_, NULL); + self->SetHeldMutex(level_, nullptr); } } inline void ReaderWriterMutex::SharedLock(Thread* self) { - DCHECK(self == NULL || self == Thread::Current()); + DCHECK(self == nullptr || self == Thread::Current()); #if ART_USE_FUTEXES bool done = false; do { @@ -143,7 +144,7 @@ inline void ReaderWriterMutex::SharedLock(Thread* self) { } inline void ReaderWriterMutex::SharedUnlock(Thread* self) { - DCHECK(self == NULL || self == Thread::Current()); + DCHECK(self == nullptr || self == Thread::Current()); DCHECK(exclusive_owner_ == 0U || exclusive_owner_ == -1U); AssertSharedHeld(self); RegisterAsUnlocked(self); @@ -161,7 +162,7 @@ inline void ReaderWriterMutex::SharedUnlock(Thread* self) { if (num_pending_writers_.LoadRelaxed() > 0 || num_pending_readers_.LoadRelaxed() > 0) { // Wake any exclusive waiters as there are now no readers. - futex(state_.Address(), FUTEX_WAKE, -1, NULL, NULL, 0); + futex(state_.Address(), FUTEX_WAKE, -1, nullptr, nullptr, 0); } } } else { @@ -174,11 +175,11 @@ inline void ReaderWriterMutex::SharedUnlock(Thread* self) { } inline bool Mutex::IsExclusiveHeld(const Thread* self) const { - DCHECK(self == NULL || self == Thread::Current()); + DCHECK(self == nullptr || self == Thread::Current()); bool result = (GetExclusiveOwnerTid() == SafeGetTid(self)); if (kDebugLocking) { // Sanity debug check that if we think it is locked we have it in our held mutexes. - if (result && self != NULL && level_ != kMonitorLock && !gAborting) { + if (result && self != nullptr && level_ != kMonitorLock && !gAborting) { CHECK_EQ(self->GetHeldMutex(level_), this); } } @@ -190,11 +191,11 @@ inline uint64_t Mutex::GetExclusiveOwnerTid() const { } inline bool ReaderWriterMutex::IsExclusiveHeld(const Thread* self) const { - DCHECK(self == NULL || self == Thread::Current()); + DCHECK(self == nullptr || self == Thread::Current()); bool result = (GetExclusiveOwnerTid() == SafeGetTid(self)); if (kDebugLocking) { // Sanity that if the pthread thinks we own the lock the Thread agrees. - if (self != NULL && result) { + if (self != nullptr && result) { CHECK_EQ(self->GetHeldMutex(level_), this); } } |