async

package
v0.0.0-...-84adcdc Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultWorkerNum = runtime.GOMAXPROCS(0) * 2

DefaultWorkerNum default number of goroutines is twice the number of GOMAXPROCS

Functions

This section is empty.

Types

type AsyncResult

type AsyncResult[Result any] struct {
	Value Result
	Err   error
}

AsyncResult result struct

type IAsync

type IAsync[Result any] interface {
	AddTask(task Task[Result])
	Result() <-chan AsyncResult[Result]
}

IAsync interface

func NewAsync

func NewAsync[Result any](maxWorkerNum int) IAsync[Result]

NewAsync ...

type Task

type Task[Result any] func() (Result, error)

Task task func

Jump to

Keyboard shortcuts

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