locks

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: MIT Imports: 3 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashFunc

type HashFunc func(interface{}) uint32

HashFunc represents a hash function for string

type IDMutex

type IDMutex interface {
	LockID(identifier interface{})
	UnlockID(identifier interface{})
}

IDMutex is an interface which can lock on specific comparable identifier

func NewIDMutex

func NewIDMutex(numShard uint32, hashFn HashFunc) IDMutex

NewIDMutex create a new IDLock

type Mutex

type Mutex interface {
	Lock(context.Context) error
	Unlock()
}

Mutex accepts a context in its Lock method. It blocks the goroutine until either the lock is acquired or the context is closed.

func NewMutex

func NewMutex() Mutex

NewMutex creates a new RWMutex

Jump to

Keyboard shortcuts

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