mkmik / syncpool

generic sync.Pool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

syncpool

The mkm.pub/syncpool package provides a generic wrapper around the sync.Pool structure.

This package is just a thin wrapper around the underlying interface{} based implementation in the stdlib.

It requires go1.18. If when you're reading this go1.18 is not released yet you can download 1.18beta or just try with the latest gotip.

Usage

go get mkm.pub/syncpool
p := syncpool.New(NewFoo)
var v Foo
v = p.Get()
// ...
p.Put(v)

About

generic sync.Pool

License:MIT License


Languages

Language:Go 100.0%