mutexKit

package
v2.8.133 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mutex

type Mutex struct {
	sync.Mutex
}

Mutex 互斥锁.

PS: 结构体中使用此锁,可以考虑"匿名字段".

func NewMutex

func NewMutex() *Mutex

NewMutex Deprecated: 直接用 &Mutex{} 吧.

func (*Mutex) LockFunc

func (m *Mutex) LockFunc(f func())

func (*Mutex) TryLockFunc

func (m *Mutex) TryLockFunc(f func()) (result bool)

type RWMutex

type RWMutex struct {
	sync.RWMutex
}

RWMutex 读写锁.

PS: 结构体中使用此锁,可以考虑"匿名字段".

func NewRWMutex

func NewRWMutex() *RWMutex

NewRWMutex Deprecated: 直接用 &RWMutex{} 吧.

func (*RWMutex) LockFunc

func (m *RWMutex) LockFunc(f func())

LockFunc 写锁

func (*RWMutex) RLockFunc

func (m *RWMutex) RLockFunc(f func())

RLockFunc 读锁

func (*RWMutex) TryLockFunc

func (m *RWMutex) TryLockFunc(f func()) (result bool)

TryLockFunc 写锁

PS: 不管加锁成功还是失败,不会阻塞.

func (*RWMutex) TryRLockFunc

func (m *RWMutex) TryRLockFunc(f func()) (result bool)

TryRLockFunc 读锁

PS: 不管加锁成功还是失败,不会阻塞.

Jump to

Keyboard shortcuts

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