diff options
| author | Leonard Wang <wangdeyu0907@gmail.com> | 2022-04-13 21:14:22 +0800 |
|---|---|---|
| committer | Daniel Martí <mvdan@mvdan.cc> | 2022-09-05 08:28:34 +0000 |
| commit | bd5595d7fa4eb3e234aabeac554f2ba8f2a95790 (patch) | |
| tree | 5f1e4bc7f0e801e11b3698d199e1c4eb4fd9f7ff /src/runtime/export_test.go | |
| parent | 67e6542467321099c0ffcf77ee660e28ec211588 (diff) | |
| download | go-bd5595d7fa4eb3e234aabeac554f2ba8f2a95790.tar.xz | |
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>
Diffstat (limited to 'src/runtime/export_test.go')
| -rw-r--r-- | src/runtime/export_test.go | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index 77e4279b9d..c29d64a885 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -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 |
