mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: refactor finalizer goroutine status
Use an atomic.Uint32 to represent the state of finalizer goroutine. fingStatus will only be changed to fingWake in non fingWait state, so it is safe to set fingRunningFinalizer status in runfinq. name old time/op new time/op delta Finalizer-8 592µs ± 4% 561µs ± 1% -5.22% (p=0.000 n=10+10) FinalizerRun-8 694ns ± 6% 675ns ± 7% ~ (p=0.059 n=9+8) Change-Id: I7e4da30cec98ce99f7d8cf4c97f933a8a2d1cae1 Reviewed-on: https://go-review.googlesource.com/c/go/+/400134 Reviewed-by: Joedian Reid <joedian@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
parent
67e6542467
commit
bd5595d7fa
5 changed files with 32 additions and 28 deletions
|
|
@ -1264,10 +1264,7 @@ func SetIntArgRegs(a int) int {
|
|||
}
|
||||
|
||||
func FinalizerGAsleep() bool {
|
||||
lock(&finlock)
|
||||
result := fingwait
|
||||
unlock(&finlock)
|
||||
return result
|
||||
return fingStatus.Load()&fingWait != 0
|
||||
}
|
||||
|
||||
// For GCTestMoveStackOnNextCall, it's important not to introduce an
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue