阅读背景:

Go如何巧妙使用runtime.SetFinalizer

来源:互联网 
runtime.SetFinalizer func SetFinalizer(obj interface{}, finalizer interface{}) SetFinalizer sets the finalizer associated with obj to the provided finalizer function. When the garbage collector finds an unreachable block with an associated finalizer, it clears the association and runs finalizer(obj) in a separate goroutine. This makes obj reachable again, but now without an associated finalizer. Assuming that SetFinalizer is not called again, the next time the garbage collector sees that obj is unreachable, it will free obj runtime.SetFinalizer func SetFinalizer(obj interfa


你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: