taskpool

package
v0.0.0-...-303e327 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package taskpool provides limited pool running task

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TaskPool

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

TaskPool limited pool

func New

func New(workerCount, poolSize int) TaskPool

New returns task pool with workerCount and poolSize

func (TaskPool) Close

func (tp TaskPool) Close()

Close the pool, the function is concurrent unsafe

func (TaskPool) Run

func (tp TaskPool) Run(task func())

Run add task to pool, block if pool is full

func (TaskPool) TryRun

func (tp TaskPool) TryRun(task func()) bool

TryRun try to add task to pool, return immediately

Jump to

Keyboard shortcuts

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