mutex

package
v0.0.0-...-b628505 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 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

func (m *Mutex) Count() int

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

func (*Mutex) IsLocked

func (m *Mutex) IsLocked() bool

IsLocked 锁是否被持有

func (*Mutex) IsStarving

func (m *Mutex) IsStarving() bool

IsStarving 锁是否处于饥饿状态

func (*Mutex) IsWoken

func (m *Mutex) IsWoken() bool

IsWoken 是否有等待者被唤醒

func (*Mutex) TryLock

func (m *Mutex) TryLock() bool

type RecursiveMutex

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

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

func (*RecursiveMutex) Lock

func (m *RecursiveMutex) Lock()

func (*RecursiveMutex) Unlock

func (m *RecursiveMutex) Unlock()

type TokenRecursiveMutex

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

TokenRecursiveMutex Token方式的递归锁

func (*TokenRecursiveMutex) Lock

func (m *TokenRecursiveMutex) Lock(token int64)

Lock 请求锁,需要传入token

func (*TokenRecursiveMutex) Unlock

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