sm
/
cache
1
0
Fork 0

c can be collected. It isn't necessarily (right after)

This commit is contained in:
Patrick Mylund Nielsen 2012-06-22 03:44:04 +01:00
parent 23661b37bd
commit 8495026156
1 changed files with 1 additions and 1 deletions

View File

@ -308,7 +308,7 @@ func New(de, ci time.Duration) *Cache {
// This trick ensures that the janitor goroutine (which--granted it was enabled--is
// running DeleteExpired on c forever) does not keep the returned C object from being
// garbage collected. When it is garbage collected, the finalizer stops the janitor
// goroutine, after which c is collected.
// goroutine, after which c can be collected.
C := &Cache{c}
if ci > 0 {
runtime.SetFinalizer(C, stopJanitor)