| 1 |
// Copyright 2020 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
//go:build !goexperiment.staticlockranking |
| 6 |
|
| 7 |
package runtime |
| 8 |
|
| 9 |
const staticLockRanking = false |
| 10 |
|
| 11 |
// // lockRankStruct is embedded in mutex, but is empty when staticklockranking is |
| 12 |
// disabled (the default) |
| 13 |
type lockRankStruct struct { |
| 14 |
} |
| 15 |
|
| 16 |
func lockInit(l *mutex, rank lockRank) { |
| 17 |
} |
| 18 |
|
| 19 |
func getLockRank(l *mutex) lockRank { |
| 20 |
return 0 |
| 21 |
} |
| 22 |
|
| 23 |
func lockWithRank(l *mutex, rank lockRank) { |
| 24 |
lock2(l) |
| 25 |
} |
| 26 |
|
| 27 |
// This function may be called in nosplit context and thus must be nosplit. |
| 28 |
// |
| 29 |
//go:nosplit |
| 30 |
func acquireLockRankAndM(rank lockRank) { |
| 31 |
acquirem() |
| 32 |
} |
| 33 |
|
| 34 |
func unlockWithRank(l *mutex) { |
| 35 |
unlock2(l) |
| 36 |
} |
| 37 |
|
| 38 |
// This function may be called in nosplit context and thus must be nosplit. |
| 39 |
// |
| 40 |
//go:nosplit |
| 41 |
func releaseLockRankAndM(rank lockRank) { |
| 42 |
releasem(getg().m) |
| 43 |
} |
| 44 |
|
| 45 |
// This function may be called in nosplit context and thus must be nosplit. |
| 46 |
// |
| 47 |
//go:nosplit |
| 48 |
func lockWithRankMayAcquire(l *mutex, rank lockRank) { |
| 49 |
} |
| 50 |
|
| 51 |
//go:nosplit |
| 52 |
func assertLockHeld(l *mutex) { |
| 53 |
} |
| 54 |
|
| 55 |
//go:nosplit |
| 56 |
func assertRankHeld(r lockRank) { |
| 57 |
} |
| 58 |
|
| 59 |
//go:nosplit |
| 60 |
func worldStopped() { |
| 61 |
} |
| 62 |
|
| 63 |
//go:nosplit |
| 64 |
func worldStarted() { |
| 65 |
} |
| 66 |
|
| 67 |
//go:nosplit |
| 68 |
func assertWorldStopped() { |
| 69 |
} |
| 70 |
|
| 71 |
//go:nosplit |
| 72 |
func assertWorldStoppedOrLockHeld(l *mutex) { |
| 73 |
} |