mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: check partial lock ranking order
To ease readability we typically keep the partial order lists sorted by rank. This isn't required for correctness, it just makes it (slightly) easier to read the lists. Currently we must notice out-of-order entries during code review, which is an error-prone process. Add a test to enforce ordering, and fix the errors that have crept in. Most of the existing errors were misordered lockRankHchan or lockRankPollDesc. While we're here, I've moved the correctness check that the partial ordering satisfies the total ordering from init to a test case. This will allow us to catch these errors without even running staticlockranking. Change-Id: I9c11abe49ea26c556439822bb6a3183129600c3b Reviewed-on: https://go-review.googlesource.com/c/go/+/300171 Trust: Michael Pratt <mpratt@google.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
parent
5ce51ea741
commit
c41bf9ee81
4 changed files with 60 additions and 24 deletions
|
|
@ -46,6 +46,14 @@ var NetpollGenericInit = netpollGenericInit
|
|||
var Memmove = memmove
|
||||
var MemclrNoHeapPointers = memclrNoHeapPointers
|
||||
|
||||
var LockPartialOrder = lockPartialOrder
|
||||
|
||||
type LockRank lockRank
|
||||
|
||||
func (l LockRank) String() string {
|
||||
return lockRank(l).String()
|
||||
}
|
||||
|
||||
const PreemptMSupported = preemptMSupported
|
||||
|
||||
type LFNode struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue