From: Jason7602 Date: Mon, 1 Nov 2021 15:27:45 +0000 (+0800) Subject: sync: remove the redundant logic on sync.(*Pool).Put X-Git-Tag: go1.19beta1~359 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=507a44dc228a3817e7007f292a404fe6c9f66315;p=gostls13.git 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 Auto-Submit: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Reviewed-by: David Chase TryBot-Result: Gopher Robot --- 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()