xsync

package
v0.40.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package xsync provides strongly typed concurrency primitives.

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
}

Pool is a generic wrapper around sync.Pool. It enforces zero-allocation object reuse by eliminating the interface{} (any) boxing and type assertion overhead required by the standard library pool.

func NewPool

func NewPool[T any](factory func() *T) *Pool[T]

NewPool creates a new typed pool. The factory must return a pointer.

func (*Pool[T]) Get

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

Get retrieves a pooled item.

func (*Pool[T]) Put

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

Put returns an item to the pool. Callers MUST reset the item's state before returning it to avoid data contamination.

Jump to

Keyboard shortcuts

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