Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FinalizeWrapper ¶
type FinalizeWrapper[T any] struct { // contains filtered or unexported fields }
FinalizeWrapper Will run fin as finalizer when the wrapper object becomes unreachable _and_ is garbage collected. Note that using finalizers to manage resource heavy (e.g. memory regions) or scarce objects (e.g. file handles) is generally considered to be an anti-pattern (i.e. bad idea).
func NewFinalizeWrapper ¶
func NewFinalizeWrapper[T any](obj T, fin func(obj T)) *FinalizeWrapper[T]
func (*FinalizeWrapper[T]) ForceFinalize ¶
func (inst *FinalizeWrapper[T]) ForceFinalize()
func (*FinalizeWrapper[T]) Get ¶
func (inst *FinalizeWrapper[T]) Get() (obj T)
Get May return a stale/invalidated obj if ForceFinalize() has been called before.
Click to show internal directories.
Click to hide internal directories.