syncpool

package
v0.0.0-...-c3fa2bf Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package syncpool provides a generic wrapper around sync.Pool Copied from https://github.com/mkmik/syncpool

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

type Pool[T any] struct {
	// contains filtered or unexported fields
}

A Pool is a generic wrapper around a sync.Pool.

func New

func New[T any](fn func() T) Pool[T]

New creates a new Pool with the provided new function.

The equivalent sync.Pool construct is "sync.Pool{New: fn}"

func (*Pool[T]) Get

func (p *Pool[T]) Get() T

Get is a generic wrapper around sync.Pool's Get method.

func (*Pool[T]) Put

func (p *Pool[T]) Put(x T)

Get is a generic wrapper around sync.Pool's Put method.

Jump to

Keyboard shortcuts

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