Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumGoworker pool patternSingle-choice MCQ

You bound concurrency to K with a semaphore implemented as a buffered channel of empty structs. Why is `chan struct{}` preferred over `chan bool` for this token pattern?

sem := make(chan struct{}, K) sem <- struct{}{} // acquire <-sem // release