1
0
mirror of https://github.com/golang/go synced 2024-11-18 18:54:42 -07:00

imports: use chan struct{} for disk semaphore

Update golang/go#7747

LGTM=bradfitz
R=bradfitz, iant
CC=golang-codereviews
https://golang.org/cl/86280043
This commit is contained in:
Josh Bleecher Snyder 2014-04-09 17:40:05 -07:00
parent 8caaaf224f
commit 3bca0c7d87

View File

@ -175,9 +175,9 @@ var pkgIndex struct {
} }
// gate is a semaphore for limiting concurrency. // gate is a semaphore for limiting concurrency.
type gate chan bool type gate chan struct{}
func (g gate) enter() { g <- true } func (g gate) enter() { g <- struct{}{} }
func (g gate) leave() { <-g } func (g gate) leave() { <-g }
// fsgate protects the OS & filesystem from too much concurrency. // fsgate protects the OS & filesystem from too much concurrency.