multimutex

package
v0.14.0-beta.rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 3 Imported by: 0 modules, 0 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 HashMutex

type HashMutex struct {
	// contains filtered or unexported fields
}

HashMutex is a struct that keeps track of a set of mutexes with a given hash. It can be used for making sure only one goroutine gets given the mutex per hash.

func NewHashMutex

func NewHashMutex() *HashMutex

NewHashMutex creates a new Mutex.

func (*HashMutex) Lock

func (c *HashMutex) Lock(hash lntypes.Hash)

Lock locks the mutex by the given hash. If the mutex is already locked by this hash, Lock blocks until the mutex is available.

func (*HashMutex) Unlock

func (c *HashMutex) Unlock(hash lntypes.Hash)

Unlock unlocks the mutex by the given hash. It is a run-time error if the mutex is not locked by the hash on entry to Unlock.

type Mutex

type Mutex struct {
	// contains filtered or unexported fields
}

Mutex is a struct that keeps track of a set of mutexes with a given ID. It can be used for making sure only one goroutine gets given the mutex per ID.

func NewMutex

func NewMutex() *Mutex

NewMutex creates a new Mutex.

func (*Mutex) Lock

func (c *Mutex) Lock(id uint64)

Lock locks the mutex by the given ID. If the mutex is already locked by this ID, Lock blocks until the mutex is available.

func (*Mutex) Unlock

func (c *Mutex) Unlock(id uint64)

Unlock unlocks the mutex by the given ID. It is a run-time error if the mutex is not locked by the ID on entry to Unlock.

Jump to

Keyboard shortcuts

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