Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PoolOption ¶
PoolOption represents an option for configuring the SizedPool.
type SizedPool ¶
type SizedPool[T any] struct { // contains filtered or unexported fields }
SizedPool is a pool with a maximum size that blocks on Get when the pool is exhausted.
func New ¶
func New[T any](options ...PoolOption[T]) (*SizedPool[T], error)
New creates a new SizedPool with the given options.
func (*SizedPool[T]) Discard ¶ added in v0.8.0
func (sz *SizedPool[T]) Discard()
Discard releases the semaphore slot without returning the item to the pool.
Use this when you need to discard an item obtained via [Get] without reusing it. This prevents semaphore leaks when items are intentionally not returned to the pool.
func (*SizedPool[T]) Get ¶
Get retrieves an item from the pool, blocking if necessary until an item is available.
Click to show internal directories.
Click to hide internal directories.