pr2

package module
v0.0.0-...-8ac2318 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 9 Imported by: 2 modules, 21 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

pr

parallel utils

Documentation

Index

Constants

View Source
const ConsumeTheory = `` /* 640-byte string literal not displayed */
View Source
const PoolTheory = `` /* 602-byte string literal not displayed */
View Source
const WaitGroupTheory = `` /* 488-byte string literal not displayed */

Variables

View Source
var WaitGroupKey = waitGroupKey{}

Functions

func Consume

func Consume[T any](
	ctx context.Context,
	numThread int,
	fn func(threadID int, value T) error,
	options ...ConsumeOption,
) (
	put Put[T],
	wait Wait,
)

Types

type BacklogSize

type BacklogSize int

func (BacklogSize) IsConsumeOption

func (BacklogSize) IsConsumeOption()

type ConsumeOption

type ConsumeOption interface {
	IsConsumeOption()
}

type Pool

type Pool[T any] struct {
	// contains filtered or unexported fields
}

func NewPool

func NewPool[T any](
	capacity uint32,
	newFunc func() T,
) *Pool[T]

func (*Pool[T]) Get

func (p *Pool[T]) Get(ptr *T) (put func() bool)

func (*Pool[T]) GetRC

func (p *Pool[T]) GetRC(ptr *T) (
	put func() bool,
	incRef func(),
)

func (*Pool[T]) Getter

func (p *Pool[T]) Getter() (
	get func(*T),
	putAll func(),
)

type Put

type Put[T any] func(T) bool

type Wait

type Wait = func(noMorePut bool) error

type WaitGroup

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

func GetWaitGroup

func GetWaitGroup(ctx context.Context) *WaitGroup

func NewWaitGroup

func NewWaitGroup(ctx context.Context) *WaitGroup

func (*WaitGroup) Add

func (w *WaitGroup) Add() (done func())

func (*WaitGroup) Cancel

func (w *WaitGroup) Cancel()

func (*WaitGroup) Deadline

func (w *WaitGroup) Deadline() (deadline time.Time, ok bool)

func (*WaitGroup) Done

func (w *WaitGroup) Done() <-chan struct{}

func (*WaitGroup) Err

func (w *WaitGroup) Err() error

func (*WaitGroup) Go

func (w *WaitGroup) Go(fn func())

func (*WaitGroup) Value

func (w *WaitGroup) Value(key any) any

func (*WaitGroup) Wait

func (w *WaitGroup) Wait()

Jump to

Keyboard shortcuts

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