aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/lockrank.go
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2020-04-17 15:25:03 -0400
committerMichael Pratt <mpratt@google.com>2020-04-17 20:24:04 +0000
commit646b4ac06583396bb296f9b3f855fdab4ebe0060 (patch)
treef3d8915b9f4a9cad088486933a12de8313fd3edb /src/runtime/lockrank.go
parent2ff1e3ebf5de77325c0e96a6c2a229656fc7be50 (diff)
downloadgo-646b4ac06583396bb296f9b3f855fdab4ebe0060.tar.gz
go-646b4ac06583396bb296f9b3f855fdab4ebe0060.zip
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 <danscales@google.com>
Diffstat (limited to 'src/runtime/lockrank.go')
-rw-r--r--src/runtime/lockrank.go3
1 files changed, 2 insertions, 1 deletions
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