util

package
v0.0.0-...-2f77c0e Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusUnlock uint32 = 0
	StatusLock   uint32 = 1
)
----------------- OnlyOneMu Start -----------------

不可重入的悲观锁实现 | 不会等待,立即返回 | 基于变量的原子操作实现

Variables

View Source
var SyncError = fmt.Errorf("We are working on the task! please try again later")

Functions

This section is empty.

Types

type FuncType1

type FuncType1 func() error

常见的函数签名类型

type FuncType2

type FuncType2 func() (interface{}, error)

type OnlyOne

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

func (*OnlyOne) Do

func (o *OnlyOne) Do(f FuncType1) error

func (*OnlyOne) DoType2

func (o *OnlyOne) DoType2(f FuncType2) (interface{}, error)

type OnlyOneMu

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

func (*OnlyOneMu) TryLock

func (in *OnlyOneMu) TryLock() bool

func (*OnlyOneMu) Unlock

func (in *OnlyOneMu) Unlock()

Jump to

Keyboard shortcuts

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