From: Rhys Hiltner Date: Tue, 8 Apr 2025 18:34:56 +0000 (-0700) Subject: runtime: fix test of when a mutex is contended X-Git-Tag: go1.25rc1~429 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7ce45a014c52375d6a3da577828c9f035a72857a;p=gostls13.git 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 --- 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) {