locks

package
v0.0.0-...-8e6cb86 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flock

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

func (*Flock) Clean

func (l *Flock) Clean() error

func (*Flock) Lock

func (l *Flock) Lock(ctx context.Context) error

func (*Flock) RLock

func (l *Flock) RLock(ctx context.Context) error

func (*Flock) RUnlock

func (l *Flock) RUnlock() error

func (*Flock) TryLock

func (l *Flock) TryLock(ctx context.Context) (bool, error)

func (*Flock) TryRLock

func (l *Flock) TryRLock(ctx context.Context) (bool, error)

func (*Flock) Unlock

func (l *Flock) Unlock() error

type Locker

type Locker interface {
	Lock(ctx context.Context) error
	TryLock(ctx context.Context) (bool, error)
	Unlock() error
	Clean() error
}

type Multi

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

func (*Multi) Add

func (m *Multi) Add(l Locker)

func (*Multi) AddFunc

func (m *Multi) AddFunc(f UnlockFunc)

func (*Multi) Unlock

func (m *Multi) Unlock() error

type RWLocker

type RWLocker interface {
	Locker
	RLock(ctx context.Context) error
	TryRLock(ctx context.Context) (bool, error)
	RUnlock() error
}

func NewFlock

func NewFlock(name, p string) RWLocker

func NewMutex

func NewMutex(name string) RWLocker

type UnlockFunc

type UnlockFunc = func() error

type Unlocker

type Unlocker interface {
	Unlock() error
}

Jump to

Keyboard shortcuts

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