Lines Matching refs:self
48 static inline pid_t SafeGetTid(const Thread* self) { in SafeGetTid() argument
49 if (self != nullptr) { in SafeGetTid()
50 return self->GetTid(); in SafeGetTid()
87 inline void BaseMutex::RegisterAsLocked(Thread* self, bool check) { in RegisterAsLocked() argument
88 if (UNLIKELY(self == nullptr)) { in RegisterAsLocked()
93 RegisterAsLockedImpl(self, level_, check); in RegisterAsLocked()
97 inline void BaseMutex::RegisterAsLockedImpl(Thread* self, LockLevel level, bool check) { in RegisterAsLockedImpl() argument
98 DCHECK(self != nullptr); in RegisterAsLockedImpl()
105 if (UNLIKELY(level == kThreadWaitLock) && self->GetHeldMutex(kThreadWaitLock) != nullptr) { in RegisterAsLockedImpl()
116 Locks::mutator_lock_->IsSharedHeld(self) && in RegisterAsLockedImpl()
117 !Locks::mutator_lock_->IsExclusiveHeld(self)) { in RegisterAsLockedImpl()
124 } else if (this == Locks::mutator_lock_ && self->GetHeldMutex(kTopLockLevel) != nullptr) { in RegisterAsLockedImpl()
126 << "kTopLevelLock (" << self->GetHeldMutex(kTopLockLevel)->name_ << "held is " in RegisterAsLockedImpl()
132 BaseMutex* held_mutex = self->GetHeldMutex(lock_level_i); in RegisterAsLockedImpl()
135 Locks::mutator_lock_->IsExclusiveHeld(self)) { in RegisterAsLockedImpl()
156 self->SetHeldMutex(level, this); in RegisterAsLockedImpl()
160 inline void BaseMutex::RegisterAsUnlocked(Thread* self) { in RegisterAsUnlocked() argument
161 if (UNLIKELY(self == nullptr)) { in RegisterAsUnlocked()
166 RegisterAsUnlockedImpl(self, level_); in RegisterAsUnlocked()
170 inline void BaseMutex::RegisterAsUnlockedImpl(Thread* self, LockLevel level) { in RegisterAsUnlockedImpl() argument
171 DCHECK(self != nullptr); in RegisterAsUnlockedImpl()
174 if (UNLIKELY(level == kThreadWaitLock) && self->GetHeldMutex(kThreadWaitWakeLock) == this) { in RegisterAsUnlockedImpl()
179 …CHECK(self->GetHeldMutex(kThreadWaitLock) != nullptr) << "Held " << kThreadWaitWakeLock << " witho… in RegisterAsUnlockedImpl()
181 CHECK(self->GetHeldMutex(level) == this) << "Unlocking on unacquired mutex: " << name_; in RegisterAsUnlockedImpl()
183 self->SetHeldMutex(level, nullptr); in RegisterAsUnlockedImpl()
187 inline void ReaderWriterMutex::SharedLock(Thread* self) { in SharedLock() argument
188 DCHECK(self == nullptr || self == Thread::Current()); in SharedLock()
197 HandleSharedLockContention(self, cur_state); in SharedLock()
204 RegisterAsLocked(self); in SharedLock()
205 AssertSharedHeld(self); in SharedLock()
208 inline void ReaderWriterMutex::SharedUnlock(Thread* self) { in SharedUnlock() argument
209 DCHECK(self == nullptr || self == Thread::Current()); in SharedUnlock()
211 AssertSharedHeld(self); in SharedUnlock()
212 RegisterAsUnlocked(self); in SharedUnlock()
236 inline bool Mutex::IsExclusiveHeld(const Thread* self) const { in IsExclusiveHeld() argument
237 DCHECK(self == nullptr || self == Thread::Current()); in IsExclusiveHeld()
238 bool result = (GetExclusiveOwnerTid() == SafeGetTid(self)); in IsExclusiveHeld()
241 if (result && self != nullptr && level_ != kMonitorLock && !gAborting) { in IsExclusiveHeld()
242 if (level_ == kThreadWaitLock && self->GetHeldMutex(kThreadWaitLock) != this) { in IsExclusiveHeld()
243 CHECK_EQ(self->GetHeldMutex(kThreadWaitWakeLock), this); in IsExclusiveHeld()
245 CHECK_EQ(self->GetHeldMutex(level_), this); in IsExclusiveHeld()
256 inline void Mutex::AssertExclusiveHeld(const Thread* self) const { in AssertExclusiveHeld() argument
258 CHECK(IsExclusiveHeld(self)) << *this; in AssertExclusiveHeld()
262 inline void Mutex::AssertHeld(const Thread* self) const { in AssertHeld() argument
263 AssertExclusiveHeld(self); in AssertHeld()
266 inline bool ReaderWriterMutex::IsExclusiveHeld(const Thread* self) const { in IsExclusiveHeld() argument
267 DCHECK(self == nullptr || self == Thread::Current()); in IsExclusiveHeld()
268 bool result = (GetExclusiveOwnerTid() == SafeGetTid(self)); in IsExclusiveHeld()
271 if (self != nullptr && result) { in IsExclusiveHeld()
272 CHECK_EQ(self->GetHeldMutex(level_), this); in IsExclusiveHeld()
293 inline void ReaderWriterMutex::AssertExclusiveHeld(const Thread* self) const { in AssertExclusiveHeld() argument
295 CHECK(IsExclusiveHeld(self)) << *this; in AssertExclusiveHeld()
299 inline void ReaderWriterMutex::AssertWriterHeld(const Thread* self) const { in AssertWriterHeld() argument
300 AssertExclusiveHeld(self); in AssertWriterHeld()
303 inline void MutatorMutex::TransitionFromRunnableToSuspended(Thread* self) { in TransitionFromRunnableToSuspended() argument
304 AssertSharedHeld(self); in TransitionFromRunnableToSuspended()
305 RegisterAsUnlockedImpl(self, kMutatorLock); in TransitionFromRunnableToSuspended()
308 inline void MutatorMutex::TransitionFromSuspendedToRunnable(Thread* self) { in TransitionFromSuspendedToRunnable() argument
309 RegisterAsLockedImpl(self, kMutatorLock, kDebugLocking); in TransitionFromSuspendedToRunnable()
310 AssertSharedHeld(self); in TransitionFromSuspendedToRunnable()
313 inline ReaderMutexLock::ReaderMutexLock(Thread* self, ReaderWriterMutex& mu) in ReaderMutexLock() argument
314 : self_(self), mu_(mu) { in ReaderMutexLock()