From 646b4ac06583396bb296f9b3f855fdab4ebe0060 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 17 Apr 2020 15:25:03 -0400 Subject: [PATCH] runtime: explictly state lock ordering direction At least as far as I can tell, this file never explicitly states whether locks with higher or lower rank should be taken first. It is implied in some comments, and clear from the code, of course. Add an explicit comment to make things more clear and hopefully reduce new locks being adding in the wrong spot. Change-Id: I17c6fd5fc216954e5f3550cf91f17e25139f1587 Reviewed-on: https://go-review.googlesource.com/c/go/+/228785 Reviewed-by: Dan Scales --- src/runtime/lockrank.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/runtime/lockrank.go b/src/runtime/lockrank.go index 4b7273aa5f..784f4236f4 100644 --- a/src/runtime/lockrank.go +++ b/src/runtime/lockrank.go @@ -27,7 +27,8 @@ package runtime type lockRank int // Constants representing the lock rank of the architecture-independent locks in -// the runtime. +// the runtime. Locks with lower rank must be taken before locks with higher +// rank. const ( lockRankDummy lockRank = iota -- 2.50.0