sync_queue

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelContext added in v1.0.0

type CancelContext struct {
	Ctx    context.Context
	Cancel context.CancelFunc
}

type Limiter

type Limiter struct {
	SLock    sync.Mutex
	LimitMap map[int64]bool
	LimitNum chan bool

	CanCtxList map[int64]*CancelContext
	// contains filtered or unexported fields
}

func NewLimiter

func NewLimiter(limit int64) *Limiter

func (*Limiter) Add

func (p *Limiter) Add()

func (*Limiter) Cancel added in v1.0.0

func (p *Limiter) Cancel(id int64)

func (*Limiter) Close

func (p *Limiter) Close(id int64)

func (*Limiter) Context added in v1.0.0

func (p *Limiter) Context(id int64) context.Context

func (*Limiter) Done

func (p *Limiter) Done()

func (*Limiter) Open

func (p *Limiter) Open(id int64) bool

* Open|Close Used to restrict the execution of programs with the same ID, only one program with the same ID can be executed at a time *

Jump to

Keyboard shortcuts

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