]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: reword the documentation for Pinner
authorRob Pike <r@golang.org>
Sat, 16 Sep 2023 05:22:44 +0000 (15:22 +1000)
committerRob Pike <r@golang.org>
Sat, 23 Sep 2023 21:06:51 +0000 (21:06 +0000)
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>

src/runtime/pinner.go

index eb62a0fd538bc16bac7aa648fda57441a31fc6f9..c0db91eba80f13fdcd37dd906a7f30fdd889ef17 100644 (file)
@@ -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.