sched

package
v0.0.0-...-bf1bca9 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Copyright 2022 Changkun Ou <changkun.de>. All rights reserved. Use of this source code is governed by a GPLv3 license that can be found in the LICENSE file. https://hub.fastgit.xyz/polyred/polyred/blob/main/internal/sched/sched.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(w *Pool)

Option is a scheduler option.

func Randomizer

func Randomizer(f func(min, max int) int) Option

func Workers

func Workers(limit int) Option

type Pool

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

Pool is a worker pool.

func New

func New(opts ...Option) *Pool

New creates a new task scheduler and returns a pool of workers.

func (*Pool) Add

func (p *Pool) Add(numTasks int) int

func (*Pool) Release

func (p *Pool) Release()

func (*Pool) Run

func (p *Pool) Run(f ...func())

Run runs f in the current pool.

func (*Pool) RunWithArgs

func (p *Pool) RunWithArgs(f func(args any), args any)

func (*Pool) Running

func (p *Pool) Running() uint64

func (*Pool) Wait

func (p *Pool) Wait()

Jump to

Keyboard shortcuts

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