common

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 1 Imported by: 1

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 Retry

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

func Timed

func Timed(retryTimes int, delayTime uint32) Retry

return a Retry delayTime is millisecond

func (Retry) On

func (r Retry) On(caller func() error) error

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