Commit bab302de authored by Russ Cox's avatar Russ Cox Committed by Rob Pike

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
parent 7f6a7e22
...@@ -408,16 +408,14 @@ func genericReadFrom(w io.Writer, r io.Reader) (n int64, err error) { ...@@ -408,16 +408,14 @@ func genericReadFrom(w io.Writer, r io.Reader) (n int64, err error) {
var threadLimit = make(chan struct{}, 500) var threadLimit = make(chan struct{}, 500)
func init() { // Using send for acquire is fine here because we are not using this
for i := 0; i < cap(threadLimit); i++ { // to protect any memory. All we care about is the number of goroutines
threadLimit <- struct{}{} // making calls at a time.
}
}
func acquireThread() { func acquireThread() {
<-threadLimit threadLimit <- struct{}{}
} }
func releaseThread() { func releaseThread() {
threadLimit <- struct{}{} <-threadLimit
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment