1
0
mirror of https://github.com/golang/go synced 2024-09-25 15:20:13 -06:00

undo CL 13348045 / 43675523c526

There is no reason to do this, and it's more work.

««« original CL description
net: make channel-based semaphore depend on receive, not send

R=r, dvyukov
CC=golang-dev
https://golang.org/cl/13348045

»»»

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13632047
This commit is contained in:
Russ Cox 2013-09-11 20:29:22 -04:00 committed by Rob Pike
parent 7f6a7e22a8
commit bab302dea2

View File

@ -408,16 +408,14 @@ func genericReadFrom(w io.Writer, r io.Reader) (n int64, err error) {
var threadLimit = make(chan struct{}, 500)
func init() {
for i := 0; i < cap(threadLimit); i++ {
threadLimit <- struct{}{}
}
}
// Using send for acquire is fine here because we are not using this
// to protect any memory. All we care about is the number of goroutines
// making calls at a time.
func acquireThread() {
<-threadLimit
threadLimit <- struct{}{}
}
func releaseThread() {
threadLimit <- struct{}{}
<-threadLimit
}