internal

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrettyDuration added in v0.3.1

func PrettyDuration(d time.Duration) string

func PrettySince added in v0.3.1

func PrettySince(t time.Time) string

Types

type SortableMutex

type SortableMutex struct {
	sync.Mutex
	// contains filtered or unexported fields
}

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().

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL