]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: explictly state lock ordering direction
authorMichael Pratt <mpratt@google.com>
Fri, 17 Apr 2020 19:25:03 +0000 (15:25 -0400)
committerMichael Pratt <mpratt@google.com>
Fri, 17 Apr 2020 20:24:04 +0000 (20:24 +0000)
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>
src/runtime/lockrank.go

index 4b7273aa5f7e081feea569f52462467ca3b3d352..784f4236f4fca99f5c49695bdec8e2ceaa8ebd32 100644 (file)
@@ -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