ksync

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: MIT Imports: 3 Imported by: 3

README

ksync

  • Synchronization primitive that allows locking individual resources by unique Key.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kcond

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

func DefaultKcond

func DefaultKcond() *Kcond

func NewKcond

func NewKcond(conf ...KcondConf) *Kcond

func (*Kcond) Broadcast

func (k *Kcond) Broadcast(key any)

func (*Kcond) Lock added in v0.2.0

func (k *Kcond) Lock(key any)

func (*Kcond) Signal

func (k *Kcond) Signal(key any)

func (*Kcond) Unlock added in v0.2.0

func (k *Kcond) Unlock(key any)

func (*Kcond) Wait

func (k *Kcond) Wait(key any)

type KcondConf added in v0.2.0

type KcondConf func(*Kcond)

func WithKcondLocker added in v0.2.0

func WithKcondLocker(new func() sync.Locker) KcondConf

type Kmutex

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

func DefaultKmutex

func DefaultKmutex() *Kmutex

func NewKmutex

func NewKmutex(conf ...KmutexConf) *Kmutex

func NewKspin

func NewKspin() *Kmutex

func (*Kmutex) Lock

func (k *Kmutex) Lock(key any)

func (*Kmutex) TryLock

func (k *Kmutex) TryLock(key any) (ok bool)

func (*Kmutex) Unlock

func (k *Kmutex) Unlock(key any)

type KmutexConf added in v0.2.0

type KmutexConf func(*Kmutex)

func WithKmutexLocker added in v0.2.0

func WithKmutexLocker(new func() Mutex) KmutexConf

type Krwmutex

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

func DefaultKrwmutex

func DefaultKrwmutex() *Krwmutex

func NewKrwmutex

func NewKrwmutex(conf ...KrwmutexConf) *Krwmutex

func (*Krwmutex) Lock

func (k *Krwmutex) Lock(key any)

func (*Krwmutex) RLock

func (k *Krwmutex) RLock(key any)

func (*Krwmutex) RLocker

func (k *Krwmutex) RLocker(key any) sync.Locker

func (*Krwmutex) RUnlock

func (k *Krwmutex) RUnlock(key any)

func (*Krwmutex) TryLock

func (k *Krwmutex) TryLock(key any) (ok bool)

func (*Krwmutex) TryRLock

func (k *Krwmutex) TryRLock(key any) (ok bool)

func (*Krwmutex) Unlock

func (k *Krwmutex) Unlock(key any)

type KrwmutexConf added in v0.2.0

type KrwmutexConf func(*Krwmutex)

func WithKrwmutexLocker added in v0.2.0

func WithKrwmutexLocker(new func() RWMutex) KrwmutexConf

type Mutex added in v0.2.0

type Mutex interface {
	Lock()
	TryLock() bool
	Unlock()
}

type RWMutex added in v0.2.0

type RWMutex interface {
	Lock()
	RLock()
	RLocker() sync.Locker
	RUnlock()
	TryLock() bool
	TryRLock() bool
	Unlock()
}

type Spin added in v0.1.1

type Spin int32

func NewSpin

func NewSpin() *Spin

func (*Spin) Lock added in v0.1.1

func (s *Spin) Lock()

func (*Spin) TryLock added in v0.1.1

func (s *Spin) TryLock() bool

func (*Spin) Unlock added in v0.1.1

func (s *Spin) Unlock()

Jump to

Keyboard shortcuts

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