summaryrefslogtreecommitdiff
path: root/usagepool.go
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2022-08-31 17:01:30 -0400
committerGitHub <noreply@github.com>2022-08-31 15:01:30 -0600
commitd4d8bbcfc64d1194079cae35697709f6d267d02f (patch)
tree8617401e3560f1eb5986878747180862822d4d4c /usagepool.go
parent68d8ac9802c5e7bf5bf55d1a3c1db634edc93999 (diff)
events: Implement event system (#4912)
Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
Diffstat (limited to 'usagepool.go')
-rw-r--r--usagepool.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/usagepool.go b/usagepool.go
index c344415..7007849 100644
--- a/usagepool.go
+++ b/usagepool.go
@@ -25,15 +25,15 @@ import (
// only inserted if they do not already exist. There
// are two ways to add values to the pool:
//
-// 1) LoadOrStore will increment usage and store the
-// value immediately if it does not already exist.
-// 2) LoadOrNew will atomically check for existence
-// and construct the value immediately if it does
-// not already exist, or increment the usage
-// otherwise, then store that value in the pool.
-// When the constructed value is finally deleted
-// from the pool (when its usage reaches 0), it
-// will be cleaned up by calling Destruct().
+// 1. LoadOrStore will increment usage and store the
+// value immediately if it does not already exist.
+// 2. LoadOrNew will atomically check for existence
+// and construct the value immediately if it does
+// not already exist, or increment the usage
+// otherwise, then store that value in the pool.
+// When the constructed value is finally deleted
+// from the pool (when its usage reaches 0), it
+// will be cleaned up by calling Destruct().
//
// The use of LoadOrNew allows values to be created
// and reused and finally cleaned up only once, even
@@ -196,7 +196,7 @@ func (up *UsagePool) Delete(key any) (deleted bool, err error) {
// References returns the number of references (count of usages) to a
// key in the pool, and true if the key exists, or false otherwise.
-func (up *UsagePool) References(key interface{}) (int, bool) {
+func (up *UsagePool) References(key any) (int, bool) {
up.RLock()
upv, loaded := up.pool[key]
up.RUnlock()