Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Counter ¶ added in v0.9.1
type Counter struct { Value int // contains filtered or unexported fields }
func NewCounter ¶ added in v0.9.1
func NewCounter() *Counter
func (*Counter) WaitExactly ¶ added in v0.9.1
type LockerMap ¶ added in v0.8.1
type LockerMap struct {
// contains filtered or unexported fields
}
A LockerMap manages a map of sync.Mutex for safely accessing resources that are distinguished by a key
func NewLockerMap ¶ added in v0.8.1
func (*LockerMap) Lock ¶ added in v0.8.1
Lock a resource. Calls sync.Mutex.Lock() for the mutex defined for this key.
type MaxLimiter ¶
func NewMaxLimiter ¶
func NewMaxLimiter(max int) *MaxLimiter
Keep number of active locks below the Max count. Useful for limiting the number of goroutines running simultaneously
type RWLockerMap ¶ added in v0.8.1
type RWLockerMap struct {
// contains filtered or unexported fields
}
Create a map of sync.RWMutex
func NewRWLockerMap ¶ added in v0.8.1
func NewRWLockerMap(capacity int) *RWLockerMap
func (*RWLockerMap) Lock ¶ added in v0.8.1
func (m *RWLockerMap) Lock(key string) *sync.RWMutex
Lock a resource for reading. Calls sync.RWMutex.Lock on the mutex for this key.
func (*RWLockerMap) RLock ¶ added in v0.8.1
func (m *RWLockerMap) RLock(key string) *sync.RWMutex
Lock a resource for reading. Calls sync.RWMutex.RLock on the mutex for this key.
func (*RWLockerMap) RUnlock ¶ added in v0.8.1
func (m *RWLockerMap) RUnlock(key string)
Unlock a resource that was locked for reading. Calls sync.RWMutex.Unlock on the mutex for this key.
func (*RWLockerMap) RWith ¶ added in v0.8.1
func (m *RWLockerMap) RWith(key string, cb func())
Safely read from a resource using a function
func (*RWLockerMap) Unlock ¶ added in v0.8.1
func (m *RWLockerMap) Unlock(key string)
Unlock a resource that was locked for reading a writing. Calls sync.RWMutex.Unlock on the mutex for this key.
func (*RWLockerMap) With ¶ added in v0.8.1
func (m *RWLockerMap) With(key string, cb func())
Safely read/write a resource using a function