mirror of
https://github.com/golang/go
synced 2024-11-25 10:07:56 -07:00
Clarify that a new goroutine is not started for each finalizer.
R=rsc CC=golang-dev https://golang.org/cl/1698051
This commit is contained in:
parent
9867ced972
commit
5958fd7f89
@ -105,11 +105,11 @@ func Semrelease(s *uint32)
|
||||
|
||||
// SetFinalizer sets the finalizer associated with x to f.
|
||||
// When the garbage collector finds an unreachable block
|
||||
// with an associated finalizer, it clears the association and creates
|
||||
// a new goroutine running f(x). Creating the new goroutine makes
|
||||
// x reachable again, but now without an associated finalizer.
|
||||
// Assuming that SetFinalizer is not called again, the next time
|
||||
// the garbage collector sees that x is unreachable, it will free x.
|
||||
// with an associated finalizer, it clears the association and runs
|
||||
// f(x) in a separate goroutine. This makes x reachable again, but
|
||||
// now without an associated finalizer. Assuming that SetFinalizer
|
||||
// is not called again, the next time the garbage collector sees
|
||||
// that x is unreachable, it will free x.
|
||||
//
|
||||
// SetFinalizer(x, nil) clears any finalizer associated with f.
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user