A Go library implementing the semaphore pattern with timeout support for lock/unlock operations.
Semaphore is a Go library that implements the semaphore concurrency pattern to control access to shared resources or limit throughput across goroutines. It provides a clean API with timeout support for both acquiring and releasing locks, making it suitable for building scalable and resilient concurrent applications.
Go developers building concurrent applications that require precise control over resource access or request throttling, such as web servers or parallel task executors.
Developers choose Semaphore for its idiomatic Go API, seamless integration with Go's context package for cancellation, and built-in timeout support to prevent deadlocks, offering a minimal and reliable solution for concurrency control.
🚦 Semaphore pattern implementation with timeout of lock/unlock operations.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides configurable timeouts for lock acquisition and release, and integrates seamlessly with Go's context package for cancellation, as shown in the HTTP handler example to prevent deadlocks.
Offers a minimal, clean API that aligns with Go's concurrency patterns, making it easy to adopt for developers familiar with the language's native primitives.
Includes a command-line utility for executing multiple console commands in parallel with semaphore-based coordination, demonstrated in the semaphore create/add/wait example.
Follows SemVer for versioning, ensuring predictable release cycles and stable updates, as mentioned in the integration section.
The library is not backward-compatible through major versions, which can cause migration headaches and code updates, as explicitly stated in the README.
Version v5 is focused on integration with the breaker package, adding an external dependency that might not be necessary for all use cases, potentially increasing complexity.
Multiple branches (master, v4, v5) with different installation commands, such as specific go get paths, can confuse users and complicate setup.