sync

package
v0.46.12 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPoolClosed = ants.ErrPoolClosed

ErrPoolClosed is returned when submitting task to a closed pool.

Functions

This section is empty.

Types

type KeyLocker

type KeyLocker[K comparable] struct {
	// contains filtered or unexported fields
}

func NewKeyLocker

func NewKeyLocker[K comparable]() *KeyLocker[K]

func (*KeyLocker[K]) Lock

func (l *KeyLocker[K]) Lock(key K)

func (*KeyLocker[K]) Unlock

func (l *KeyLocker[K]) Unlock(key K)

type WorkerPool added in v0.46.10

type WorkerPool interface {
	// Submit queues a function for execution
	// in a separate routine.
	//
	// Implementation must return any error encountered
	// that prevented the function from being queued.
	Submit(func()) error

	// Release releases worker pool resources. All `Submit` calls will
	// finish with ErrPoolClosed. It doesn't wait until all submitted
	// functions have returned so synchronization must be achieved
	// via other means (e.g. sync.WaitGroup).
	Release()
}

WorkerPool represents a tool to control the execution of go-routine pool.

func NewPseudoWorkerPool added in v0.46.10

func NewPseudoWorkerPool() WorkerPool

NewPseudoWorkerPool returns a new instance of a synchronous worker pool.

Jump to

Keyboard shortcuts

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