sync

package
v0.34.4 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RingMutex

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

func NewRingMutex

func NewRingMutex(mutexCount int, hashMaker func() hash.Hash64) *RingMutex

Create a RW mutex that provides a pseudo-independent set of mutexes for addresses where the address space is mapped into possibly much smaller set of backing mutexes using the xxhash (non-cryptographic) hash function // modulo size. If some addresses collide modulo size they will be unnecessary contention between those addresses, but you can trade space against contention as desired.

func NewRingMutexNoHash

func NewRingMutexNoHash(mutexCount int) *RingMutex

func NewRingMutexXXHash

func NewRingMutexXXHash(mutexCount int) *RingMutex

func (*RingMutex) Lock

func (mtx *RingMutex) Lock(address []byte) (value *Value)

func (*RingMutex) Mutex

func (mtx *RingMutex) Mutex(address []byte) *sync.RWMutex

func (*RingMutex) MutexCount

func (mtx *RingMutex) MutexCount() uint64

Return the size of the underlying array of mutexes

func (*RingMutex) RLock

func (mtx *RingMutex) RLock(address []byte)

func (*RingMutex) RUnlock

func (mtx *RingMutex) RUnlock(address []byte)

func (*RingMutex) Unlock

func (mtx *RingMutex) Unlock(address []byte)

type Value added in v0.20.1

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

func (*Value) Get added in v0.20.1

func (v *Value) Get() interface{}

func (*Value) IsSet added in v0.20.1

func (v *Value) IsSet() bool

func (*Value) Set added in v0.20.1

func (v *Value) Set(value interface{})

Jump to

Keyboard shortcuts

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