onlyone

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

This section is empty.

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 OnlyOneCh

type OnlyOneCh chan bool

mod 不可重入锁 | 使用channel作为并发控制入口,每次只允许一个协程进入临界区 | 重入报错

func GetOnlyOneCh

func GetOnlyOneCh() OnlyOneCh

func (OnlyOneCh) TryLock

func (in OnlyOneCh) TryLock() error

func (OnlyOneCh) UnLock

func (in OnlyOneCh) UnLock()

Jump to

Keyboard shortcuts

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