-
Dmitriy Vyukov authored
It turns out there is a relatively common pattern that relies on inverted channel semaphore: gate := make(chan bool, N) for ... { // limit concurrency gate <- true go func() { foo(...) <-gate }() } // join all goroutines for i := 0; i < N; i++ { gate <- true } So handle synchronization on inverted semaphores with cap>1. Fixes #7718. LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/84880046
9e1cadad