mutex

package
v1.2.12 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: Apache-2.0 Imports: 5 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 支持 TryLock

func (*Mutex) Count added in v1.1.1

func (m *Mutex) Count() int

Count 指标信息 获取等待锁的数量

func (*Mutex) IsLocked added in v1.1.1

func (m *Mutex) IsLocked() bool

IsLocked 锁是否被持有

func (*Mutex) IsStarving added in v1.1.1

func (m *Mutex) IsStarving() bool

IsStarving 锁是否处于饥饿状态

func (*Mutex) IsWoken added in v1.1.1

func (m *Mutex) IsWoken() bool

IsWoken 是否有等待者被唤醒

func (*Mutex) TryLock

func (m *Mutex) TryLock() bool

type RecursiveMutex added in v1.1.1

type RecursiveMutex struct {
	sync.Mutex
	// contains filtered or unexported fields
}

RecursiveMutex 包装一个Mutex,实现可重入

func (*RecursiveMutex) Lock added in v1.1.1

func (m *RecursiveMutex) Lock()

func (*RecursiveMutex) Unlock added in v1.1.1

func (m *RecursiveMutex) Unlock()

type TokenRecursiveMutex added in v1.1.1

type TokenRecursiveMutex struct {
	sync.Mutex
	// contains filtered or unexported fields
}

TokenRecursiveMutex Token方式的递归锁

func (*TokenRecursiveMutex) Lock added in v1.1.1

func (m *TokenRecursiveMutex) Lock(token int64)

Lock 请求锁,需要传入token

func (*TokenRecursiveMutex) Unlock added in v1.1.1

func (m *TokenRecursiveMutex) Unlock(token int64)

Unlock 释放锁

Jump to

Keyboard shortcuts

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