Skip to content

Instantly share code, notes, and snippets.

@lxwagn
lxwagn / semaphore.go
Last active June 22, 2024 12:01
Idiomatic semaphore example in Go (using Buffered Channels)
// Idiomatic Semaphore Example in Go
// Lucas Wagner
// Golang has no built-in facility to implement semaphores, so a common design
// pattern is to use buffered channels.
package main
import (
"fmt"