mutex

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2023 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mutex

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

func NewMutex

func NewMutex(root *Root, name string, options ...Option) *Mutex

func (*Mutex) Lock

func (m *Mutex) Lock() error

func (*Mutex) Unlock

func (m *Mutex) Unlock() error

type Option

type Option interface {
	Apply(mutex *baseMutex)
}

func WithExpireDuration

func WithExpireDuration(dur time.Duration) Option

func WithWaitTimeout

func WithWaitTimeout(timeout time.Duration) Option

type OptionFunc

type OptionFunc func(mutex *baseMutex)

func (OptionFunc) Apply

func (f OptionFunc) Apply(mutex *baseMutex)

type RWMutex

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

func NewRWMutex

func NewRWMutex(r *Root, name string, options ...Option) *RWMutex

func (RWMutex) Lock

func (r RWMutex) Lock() error

func (RWMutex) RLock

func (r RWMutex) RLock() error

func (*RWMutex) Unlock

func (r *RWMutex) Unlock() error

type Root

type Root struct {
	Client *redis.Client
	UUID   string // 自定义用于区分不同客户端的唯一标识
}

Jump to

Keyboard shortcuts

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