Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConcurrentPinner ¶
ConcurrentPinner is a Pinner that is safe for concurrent use by multiple goroutines.
func (*ConcurrentPinner) Pin ¶
func (p *ConcurrentPinner) Pin(v any)
func (*ConcurrentPinner) Unpin ¶
func (p *ConcurrentPinner) Unpin()
type Pinner ¶
type Pinner interface {
// Pin pins a Go object, preventing it from being moved or freed by the
// garbage collector until the [Pinner.Unpin] method has been called.
//
// A pointer to a pinned object can be directly stored in C memory or can be
// contained in Go memory passed to C functions. If the pinned object itself
// contains pointers to Go objects, these objects must be pinned separately if
// they are going to be accessed from C code.
//
// The argument must be a pointer of any type or an [unsafe.Pointer].
// It's safe to call Pin on non-Go pointers, in which case Pin will do
// nothing.
Pin(any)
// Unpin unpins all pinned objects of the [Pinner].
Unpin()
}
A Pinner is a set of Go objects each pinned to a fixed location in memory. The [Pinner.Pin] method pins one object, while [Pinner.Unpin] unpins all pinned objects. See their comments for more information.
Click to show internal directories.
Click to hide internal directories.