mirror of
https://github.com/golang/go
synced 2024-11-18 12:24:48 -07:00
runtime: reword the documentation for Pinner
I found the documentation for Pinner itself to contain too little information. Rewrite it to give a summary and redirect to the relevant methods. Also reformat the ragged comment for Pin. Change-Id: I9c786817f43dfc9c72178127c141c35dae221104 Reviewed-on: https://go-review.googlesource.com/c/go/+/528855 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
54f78cf8f1
commit
451e4727ec
@ -9,9 +9,9 @@ import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// A Pinner is a set of pinned Go objects. An object can be pinned with
|
||||
// the Pin method and all pinned objects of a Pinner can be unpinned with the
|
||||
// Unpin method.
|
||||
// A Pinner is a set of Go objects each pinned to a fixed location in memory. The
|
||||
// [Pin] method pins one object, while [Unpin] unpins all pinned objects. See their
|
||||
// comments for more information.
|
||||
type Pinner struct {
|
||||
*pinner
|
||||
}
|
||||
@ -19,11 +19,10 @@ type Pinner struct {
|
||||
// Pin pins a Go object, preventing it from being moved or freed by the garbage
|
||||
// collector until the 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.
|
||||
// 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.
|
||||
|
Loading…
Reference in New Issue
Block a user