summaryrefslogtreecommitdiff
path: root/runtime/base/mutex.h
diff options
context:
space:
mode:
author Hans Boehm <hboehm@google.com> 2024-11-11 16:05:17 -0800
committer Hans Boehm <hboehm@google.com> 2024-11-12 16:19:02 +0000
commitdc42d4ed36d22433c8dc5f68a51e9f2acd47f34d (patch)
treeb05e0b9940eb983eb049c0c19284a2e7993f5edf /runtime/base/mutex.h
parent3051a5e03f32ca7aaae6041025ec60f90d41e34c (diff)
Clarify GetExclusiveOwner() semantics
It is inherently unreliable unless the mutex is held. Contention reports may err if the mutex has already been, or is about to be, released. Fixing this would require including exclusive_owner_ in the atomic operation part of lock/unlock operations, which would require us to rely on wider atomic operations on the fast path. So just document it better. Bug: 377068860 Test: Treehugger Change-Id: Id2be3dca573656e7aa10cf975f9a6c9275cd3541
Diffstat (limited to 'runtime/base/mutex.h')
-rw-r--r--runtime/base/mutex.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/base/mutex.h b/runtime/base/mutex.h
index e3d89e7449..9185f79ab7 100644
--- a/runtime/base/mutex.h
+++ b/runtime/base/mutex.h
@@ -394,7 +394,7 @@ class EXPORT SHARED_LOCKABLE ReaderWriterMutex : public BaseMutex {
// Id associated with exclusive owner. No memory ordering semantics if called from a thread other
// than the owner. Returns 0 if the lock is not held. Returns either 0 or -1 if it is held by
- // one or more readers.
+ // one or more readers. Not reliable unless the mutex is held.
pid_t GetExclusiveOwnerTid() const;
void Dump(std::ostream& os) const override;