package semaphore
import "github.com/purpleidea/mgmt/util/semaphore"
Package semaphore contains an implementation of a counting semaphore.
Index ¶
Types ¶
type Semaphore ¶
type Semaphore struct { C chan struct{} // contains filtered or unexported fields }
Semaphore is a counting semaphore. It must be initialized before use.
func NewSemaphore ¶
NewSemaphore creates a new semaphore.
func (*Semaphore) Close ¶
func (obj *Semaphore) Close()
Close shuts down the semaphore and releases all the locks.
func (*Semaphore) Init ¶
Init initializes the semaphore.
func (*Semaphore) P ¶
P acquires n resources.
func (*Semaphore) V ¶
V releases n resources.
Source Files ¶
- Version
- v0.0.0-20250322185616-c50a578426f1 (latest)
- Published
- Mar 22, 2025
- Platform
- linux/amd64
- Imports
- 1 packages
- Last checked
- 4 days ago –
Tools for package owners.