Commit 5958fd7f authored by Ian Lance Taylor's avatar Ian Lance Taylor

Clarify that a new goroutine is not started for each finalizer.

R=rsc
CC=golang-dev
https://golang.org/cl/1698051
parent 9867ced9
...@@ -105,11 +105,11 @@ func Semrelease(s *uint32) ...@@ -105,11 +105,11 @@ func Semrelease(s *uint32)
// SetFinalizer sets the finalizer associated with x to f. // SetFinalizer sets the finalizer associated with x to f.
// When the garbage collector finds an unreachable block // When the garbage collector finds an unreachable block
// with an associated finalizer, it clears the association and creates // with an associated finalizer, it clears the association and runs
// a new goroutine running f(x). Creating the new goroutine makes // f(x) in a separate goroutine. This makes x reachable again, but
// x reachable again, but now without an associated finalizer. // now without an associated finalizer. Assuming that SetFinalizer
// Assuming that SetFinalizer is not called again, the next time // is not called again, the next time the garbage collector sees
// the garbage collector sees that x is unreachable, it will free x. // that x is unreachable, it will free x.
// //
// SetFinalizer(x, nil) clears any finalizer associated with f. // SetFinalizer(x, nil) clears any finalizer associated with f.
// //
......
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