Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SymLock ¶
type SymLock interface {
WithMutex(symbol string, action func())
}
SymLock is the interface for a symbolic lock.
WithMutex executes the specified action using the given symbol for mutual exclusion. No two goroutines using the same SymLock and the same symbol will execute concurrently with each other.
func New ¶
func New() SymLock
New creates and returns a new SymLock with a default number of partitions, equal to twice the number of processors.
func NewWithPartitions ¶
NewWithPartitions creates and returns a new SymLock with the specified number of partitions. The number of partitions effectively places an upper limit on the degree of concurrency.
Click to show internal directories.
Click to hide internal directories.