pool

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package pool Note: This file is inspired by: Valyala, A. (2023) workerpool.go (Version 1.48.0) [Source code]. https://github.com/valyala/fasthttp/blob/master/workerpool.go 1.Change the Serve(c net.Conn) method to Submit(fn func()) error method

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WorkerPool

type WorkerPool struct {
	MaxWorkersCount int

	MaxIdleWorkerDuration time.Duration
	// contains filtered or unexported fields
}

WorkerPool serves incoming functions using a pool of workers in FILO order, i.e. the most recently stopped worker will serve the next incoming function.

Such a scheme keeps CPU caches hot (in theory).

func (*WorkerPool) Release

func (wp *WorkerPool) Release()

func (*WorkerPool) Start

func (wp *WorkerPool) Start()

func (*WorkerPool) Stop

func (wp *WorkerPool) Stop()

func (*WorkerPool) Submit

func (wp *WorkerPool) Submit(fn func()) error

Submit submits a function for serving by the pool.

Jump to

Keyboard shortcuts

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