Skip to content

Instantly share code, notes, and snippets.

@noclue
noclue / pool.go
Created March 13, 2022 21:42
Generic Pool implementation
package pkg
import "sync"
// Pool is a generic interface for managing objects to reused in many go
// routines. It resembles the sync.Pool built in type with added type safety.
type Pool[T any] interface {
Get() T
Put(T)
}