sync

package
v0.0.0-...-9cc3252 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyMutex

type KeyMutex[T any] struct {
	// contains filtered or unexported fields
}

KeyMutex provides a per-key mutex mechanism

func NewKeyMutex

func NewKeyMutex[T any]() *KeyMutex[T]

NewKeyMutex creates a new KeyMutex

func (*KeyMutex[T]) GetLock

func (l *KeyMutex[T]) GetLock(key T) *sync.Mutex

GetLock returns the mutex associated with the given key, creating it if necessary

type KeyRWMutex

type KeyRWMutex[T any] struct {
	// contains filtered or unexported fields
}

KeyRWMutex is a read-write lock with keys

func NewKeyRWMutex

func NewKeyRWMutex[T any]() *KeyRWMutex[T]

NewKeyRWMutex creates a new KeyRWMutex

func (*KeyRWMutex[T]) GetLock

func (kl *KeyRWMutex[T]) GetLock(key T) *sync.RWMutex

GetLock retrieves or creates the lock for the given key

Jump to

Keyboard shortcuts

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