Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrettyDuration ¶ added in v0.3.1
func PrettySince ¶ added in v0.3.1
Types ¶
type SortableMutex ¶
SortableMutex is a mutex with a globally unique sequence number. The sequence number allows SortableMutexes to lock a set of mutexes in a consistent order.
func NewSortableMutex ¶
func NewSortableMutex() *SortableMutex
func (*SortableMutex) AcquireDuration ¶
func (s *SortableMutex) AcquireDuration() time.Duration
func (*SortableMutex) Lock ¶ added in v0.9.2
func (s *SortableMutex) Lock()
func (*SortableMutex) Seq ¶
func (s *SortableMutex) Seq() uint64
type SortableMutexes ¶
type SortableMutexes []*SortableMutex
SortableMutexes is a set of mutexes that can be locked in a safe order. Once Lock() is called it must not be mutated!
func (SortableMutexes) Lock ¶
func (s SortableMutexes) Lock()
Lock sorts the mutexes, and then locks them in order. If any lock cannot be acquired, this will block while holding the locks with a lower sequence number. Panics if the same mutex is included more than once.
func (SortableMutexes) Unlock ¶
func (s SortableMutexes) Unlock()
Unlock unlocks the sorted set of mutexes locked by a prior call to Lock().
Click to show internal directories.
Click to hide internal directories.