syncmap

package
v0.0.0-...-ba08d48 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Unlicense Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lock

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

func (*Lock) Unlock

func (l *Lock) Unlock()

type LockMap

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

LockMap is a map of mutexes that automatically allocates and deallocates mutexes as necessary. It allows for fine-grained mutual exclusion for a potentially large key space, while only consuming space propotional to the number of acquired mutexes. The zero-initialised LockMap is ready to use.

func (*LockMap) Lock

func (m *LockMap) Lock(key string) *Lock

type Semaphore

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

func (*Semaphore) Release

func (s *Semaphore) Release(n int64)

type SemaphoreMap

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

SemaphoreMap is a map of semaphores that automatically allocates and deallocates semaphores as necessary. It allows for fine-grained semephore use, such as resource allocations and concurrent resource limits, for a potentially large key space, while only consuming space propotional to the number of acquired semaphores.

func NewSemaphoreMap

func NewSemaphoreMap(n int64) *SemaphoreMap

func (*SemaphoreMap) Acquire

func (m *SemaphoreMap) Acquire(key string, n int64) *Semaphore

func (*SemaphoreMap) AcquireContext

func (m *SemaphoreMap) AcquireContext(ctx context.Context, key string, n int64) (*Semaphore, error)

func (*SemaphoreMap) TryAcquire

func (m *SemaphoreMap) TryAcquire(key string, n int64) *Semaphore

Jump to

Keyboard shortcuts

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