]> Cypherpunks repositories - gostls13.git/commit
os: use runtime.Keepalive for *Process values
authorIan Lance Taylor <iant@golang.org>
Tue, 23 Aug 2016 22:56:43 +0000 (15:56 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 24 Aug 2016 16:57:09 +0000 (16:57 +0000)
commite69912e6f44b09d8bafde32f11642579272ab4af
tree250a6b4eba7683a39b9e3ce9d5b3b4194c2e31f9
parent9be2a279ee12d0e17646c0b0b12d8dff9b157a59
os: use runtime.Keepalive for *Process values

The os package sets a finalizer on *Process. I looked through all the
uses of *Process in the package, looking for each case where a *Process
was passed as an argument and the final reference to the argument was
not a function or method call. I added a call to runtime.KeepAlive after
each such final reference (there were only three).

The code is safe today without the KeepAlive calls because the compiler
keeps arguments alive for the duration of the function. However, that is
not a language requirement, so adding the KeepAlive calls ensures that
this code remains safe even if the compiler changes in the future.

I also removed an existing unnecessry call to runtime.KeepAlive. The
syscall.Syscall function is handled specially by the compiler to keep
its arguments alive.

Change-Id: Ibd2ff20b31ed3de4f6a59dd1633c1b44001d91d9
Reviewed-on: https://go-review.googlesource.com/27637
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/os/exec_windows.go
src/os/wait_wait6.go
src/os/wait_waitid.go