Skip to content

Instantly share code, notes, and snippets.

@wyattjoh
Created July 21, 2016 16:29
Show Gist options
  • Save wyattjoh/c2daa27386191e115bb21a9a89364150 to your computer and use it in GitHub Desktop.
Save wyattjoh/c2daa27386191e115bb21a9a89364150 to your computer and use it in GitHub Desktop.
func test() {
semaphore := make(chan struct{}, internalGoRoutineAsyncMax)
for i := 0; i < 1000; i++ {
go func() {
semaphore <- struct{}{}
defer func() { <-semaphore }()
// process...
}()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment