From 724bd0e963d90a9a721cfbd0bd12b9619540798f Mon Sep 17 00:00:00 2001 From: Patrick Mylund Nielsen Date: Fri, 22 Jun 2012 03:51:34 +0100 Subject: [PATCH] Move comment explaining the manual mutex unlocking down to the first place where we actually do it --- cache.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cache.go b/cache.go index 9fa35cc..fb4905c 100644 --- a/cache.go +++ b/cache.go @@ -34,8 +34,6 @@ type Cache struct { type cache struct { DefaultExpiration time.Duration Items map[string]*Item - // TODO: Calls to mu.Unlock are currently not deferred because defer - // adds ~200 ns (as of 792c7561af4b+ tip.) mu sync.Mutex janitor *janitor } @@ -45,6 +43,8 @@ type cache struct { func (c *cache) Set(k string, x interface{}, d time.Duration) { c.mu.Lock() c.set(k, x, d) + // TODO: Calls to mu.Unlock are currently not deferred because defer + // adds ~200 ns (as of go1.) c.mu.Unlock() }