aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/runtime
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-08-19 12:29:54 -0700
committerIan Lance Taylor <iant@golang.org>2021-09-05 16:10:51 -0700
commit74df79ec3e0a1af87e2619fc07533aba58680f0a (patch)
tree321354569188d7b7de54cd23d3c6785030163cef /libgo/go/runtime
parenta827909537cf085e5673ca7816b7bd7151d89fc5 (diff)
downloadgcc-74df79ec3e0a1af87e2619fc07533aba58680f0a.zip
gcc-74df79ec3e0a1af87e2619fc07533aba58680f0a.tar.gz
gcc-74df79ec3e0a1af87e2619fc07533aba58680f0a.tar.bz2
libgo: update to final Go 1.17 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/343729
Diffstat (limited to 'libgo/go/runtime')
-rw-r--r--libgo/go/runtime/mfinal.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/libgo/go/runtime/mfinal.go b/libgo/go/runtime/mfinal.go
index 9059889..b4afaee 100644
--- a/libgo/go/runtime/mfinal.go
+++ b/libgo/go/runtime/mfinal.go
@@ -402,6 +402,10 @@ okarg:
// Without the KeepAlive call, the finalizer could run at the start of
// syscall.Read, closing the file descriptor before syscall.Read makes
// the actual system call.
+//
+// Note: KeepAlive should only be used to prevent finalizers from
+// running prematurely. In particular, when used with unsafe.Pointer,
+// the rules for valid uses of unsafe.Pointer still apply.
func KeepAlive(x interface{}) {
// Introduce a use of x that the compiler can't eliminate.
// This makes sure x is alive on entry. We need x to be alive