Semaphores
summary
Shows two Go semaphore designs built on buffered channels: a token pool preloaded with N tokens that goroutines take, and a zeroed channel where goroutines write to claim space. Both use the channel-as-token-pool pattern with blocking semantics plus select-based timeout/cancellation to avoid long waits; examples include a 12-capacity pool, atomic multi-token acquisition for friend groups, and a browser simulation with GitHub code.
AI-written summary · about








