summaryrefslogtreecommitdiffhomepage
path: root/usagepool.go
diff options
context:
space:
mode:
authorMatthew Holt <[email protected]>2019-11-15 12:47:38 -0700
committerMatthew Holt <[email protected]>2019-11-15 12:47:38 -0700
commit0ca109db4ab0b8869a15d388ef9036d9117ec081 (patch)
treea256f55db132575b8a8d44a1ff253b3456643bc9 /usagepool.go
parent0fc97211abd46098f5953fc6b152aa891060fca5 (diff)
downloadcaddy-0ca109db4ab0b8869a15d388ef9036d9117ec081.tar.gz
caddy-0ca109db4ab0b8869a15d388ef9036d9117ec081.zip
Minor cleanups
Diffstat (limited to 'usagepool.go')
-rw-r--r--usagepool.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/usagepool.go b/usagepool.go
index df69caffc..6fd48f5b4 100644
--- a/usagepool.go
+++ b/usagepool.go
@@ -25,14 +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 increment usage and construct the
-// value immediately if it does not already exist,
-// then store that value in the pool. When the
-// constructed value is finally deleted from the
-// pool (after its usage reaches 0), it will be
-// cleaned up by calling its Destruct method.
+// 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