From 7ce45a014c52375d6a3da577828c9f035a72857a Mon Sep 17 00:00:00 2001 From: Rhys Hiltner Date: Tue, 8 Apr 2025 11:34:56 -0700 Subject: [PATCH] runtime: fix test of when a mutex is contended This is used only in tests that verify reports of runtime-internal mutex contention. For #66999 For #70602 Change-Id: I72cb1302d8ea0524f1182ec892f5c9a1923cddba Reviewed-on: https://go-review.googlesource.com/c/go/+/667095 Reviewed-by: Michael Knyszek LUCI-TryBot-Result: Go LUCI Auto-Submit: Rhys Hiltner Reviewed-by: Junyang Shao --- src/runtime/lock_spinbit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/lock_spinbit.go b/src/runtime/lock_spinbit.go index ba5268abdd..7b7bc651ad 100644 --- a/src/runtime/lock_spinbit.go +++ b/src/runtime/lock_spinbit.go @@ -143,7 +143,7 @@ func mutexPreferLowLatency(l *mutex) bool { } func mutexContended(l *mutex) bool { - return atomic.Loaduintptr(&l.key) > mutexLocked + return atomic.Loaduintptr(&l.key)&^mutexMMask != 0 } func lock(l *mutex) {