mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
runtime: relax SetFinalizer documentation to allow &local
The SetFinalizer documentation states that "The argument obj must be a pointer to an object allocated by calling new or by taking the address of a composite literal." which precludes pointers to local variables. According to a comment on #6591, this case is expected to work. This CL updates the documentation for SetFinalizer accordingly. Fixes #6591 Change-Id: Id861b3436bc1c9521361ea2d51c1ce74a121c1af Reviewed-on: https://go-review.googlesource.com/29592 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
413f1ef4de
commit
60482d8a8b
|
@ -226,8 +226,9 @@ func runfinq() {
|
|||
//
|
||||
// SetFinalizer(obj, nil) clears any finalizer associated with obj.
|
||||
//
|
||||
// The argument obj must be a pointer to an object allocated by
|
||||
// calling new or by taking the address of a composite literal.
|
||||
// The argument obj must be a pointer to an object allocated by calling
|
||||
// new, by taking the address of a composite literal, or by taking the
|
||||
// address of a local variable.
|
||||
// The argument finalizer must be a function that takes a single argument
|
||||
// to which obj's type can be assigned, and can have arbitrary ignored return
|
||||
// values. If either of these is not true, SetFinalizer aborts the
|
||||
|
|
Loading…
Reference in a new issue