Commit 1d809c5c authored by Ian Lance Taylor's avatar Ian Lance Taylor

runtime: fix names in SetFinalizer doc comment

Fixes #14554.

Change-Id: I37ab4e4dc1aee84ac448d437314f8eecbbc02994
Reviewed-on: https://go-review.googlesource.com/20021Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent f444b8a8
...@@ -216,20 +216,20 @@ func runfinq() { ...@@ -216,20 +216,20 @@ func runfinq() {
} }
} }
// SetFinalizer sets the finalizer associated with x to f. // SetFinalizer sets the finalizer associated with obj to the provided
// When the garbage collector finds an unreachable block // finalizer function. When the garbage collector finds an unreachable block
// with an associated finalizer, it clears the association and runs // with an associated finalizer, it clears the association and runs
// f(x) in a separate goroutine. This makes x reachable again, but // finalizer(obj) in a separate goroutine. This makes obj reachable again,
// now without an associated finalizer. Assuming that SetFinalizer // but now without an associated finalizer. Assuming that SetFinalizer
// is not called again, the next time the garbage collector sees // is not called again, the next time the garbage collector sees
// that x is unreachable, it will free x. // that obj is unreachable, it will free obj.
// //
// SetFinalizer(x, nil) clears any finalizer associated with x. // SetFinalizer(obj, nil) clears any finalizer associated with obj.
// //
// The argument x must be a pointer to an object allocated by // The argument obj must be a pointer to an object allocated by
// calling new or by taking the address of a composite literal. // calling new or by taking the address of a composite literal.
// The argument f must be a function that takes a single argument // The argument finalizer must be a function that takes a single argument
// to which x's type can be assigned, and can have arbitrary ignored return // 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 // values. If either of these is not true, SetFinalizer aborts the
// program. // program.
// //
...@@ -241,8 +241,8 @@ func runfinq() { ...@@ -241,8 +241,8 @@ func runfinq() {
// is not guaranteed to run, because there is no ordering that // is not guaranteed to run, because there is no ordering that
// respects the dependencies. // respects the dependencies.
// //
// The finalizer for x is scheduled to run at some arbitrary time after // The finalizer for obj is scheduled to run at some arbitrary time after
// x becomes unreachable. // obj becomes unreachable.
// There is no guarantee that finalizers will run before a program exits, // There is no guarantee that finalizers will run before a program exits,
// so typically they are useful only for releasing non-memory resources // so typically they are useful only for releasing non-memory resources
// associated with an object during a long-running program. // associated with an object during a long-running program.
...@@ -252,7 +252,7 @@ func runfinq() { ...@@ -252,7 +252,7 @@ func runfinq() {
// to depend on a finalizer to flush an in-memory I/O buffer such as a // to depend on a finalizer to flush an in-memory I/O buffer such as a
// bufio.Writer, because the buffer would not be flushed at program exit. // bufio.Writer, because the buffer would not be flushed at program exit.
// //
// It is not guaranteed that a finalizer will run if the size of *x is // It is not guaranteed that a finalizer will run if the size of *obj is
// zero bytes. // zero bytes.
// //
// It is not guaranteed that a finalizer will run for objects allocated // It is not guaranteed that a finalizer will run for objects allocated
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment