Created
July 21, 2016 16:29
-
-
Save wyattjoh/c2daa27386191e115bb21a9a89364150 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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