diff options
| author | Jason7602 <jansonzhe@gmail.com> | 2021-11-01 23:27:45 +0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-05-08 17:23:05 +0000 |
| commit | 507a44dc228a3817e7007f292a404fe6c9f66315 (patch) | |
| tree | f061bd58b69dae4687ce0b4a47bd268d1f853de1 /src/sync | |
| parent | 4c565a5561e33e1d488116ea45c35d3ce408cf93 (diff) | |
| download | go-507a44dc228a3817e7007f292a404fe6c9f66315.tar.xz | |
sync: remove the redundant logic on sync.(*Pool).Put
When the procUnpin is placed after shared.pushHead, there is
no need for x as a flag to indicate the previous process.
This CL can make the logic clear, and at the same time reduce
a redundant judgment.
Change-Id: I34ec9ba4cb5b5dbdf13a8f158b90481fed248cf5
Reviewed-on: https://go-review.googlesource.com/c/go/+/360059
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/sync')
| -rw-r--r-- | src/sync/pool.go | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/sync/pool.go b/src/sync/pool.go index d1abb6a8b7..ea142bb181 100644 --- a/src/sync/pool.go +++ b/src/sync/pool.go @@ -102,9 +102,7 @@ func (p *Pool) Put(x any) { l, _ := p.pin() if l.private == nil { l.private = x - x = nil - } - if x != nil { + } else { l.shared.pushHead(x) } runtime_procUnpin() |
