pool

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 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 pool implements a lock-free per-P object pool modeled after go-xla/internal/pool, providing very low-latency object reuse for hot-path CUDA Driver API / cuBLAS calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Linkable

type Linkable[T any] interface {
	Next() T
	SetNext(T)
}

Linkable defines the intrusive singly-linked list interface for pooled objects.

type Pool

type Pool[E any, P interface {
	*E
	Linkable[P]
}] struct {
	New func() P
	// contains filtered or unexported fields
}

Pool is a lock-free per-P object pool whose items persist across GC cycles (unlike sync.Pool).

func New

func New[E any, P interface {
	*E
	Linkable[P]
}](newFunc func() P) *Pool[E, P]

New creates a new per-P Pool with the given constructor function.

func (*Pool[E, P]) Get

func (p *Pool[E, P]) Get() P

Get retrieves an object from the current P's free list or allocates one via New.

func (*Pool[E, P]) Put

func (p *Pool[E, P]) Put(node P)

Put returns an object to the current P's free list.

Jump to

Keyboard shortcuts

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