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.
Click to show internal directories.
Click to hide internal directories.