summaryrefslogtreecommitdiff
path: root/typedsync/value.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-02-05 13:02:57 -0700
committerLuke Shumaker <lukeshu@lukeshu.com>2023-02-05 13:33:02 -0700
commit5a1a904b4264c6ee323c9bd433f9ee4da93c984d (patch)
tree035414c8e8f3b94e24b482e5096a3b4e3688e257 /typedsync/value.go
parent2d939c9c6e62395ed924fe7c5cd4c4b294e391a9 (diff)
typedsync: Bring up to being a mostly-drop-in replacement for Go 1.20 sync
Diffstat (limited to 'typedsync/value.go')
-rw-r--r--typedsync/value.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/typedsync/value.go b/typedsync/value.go
index 99c8876..90c8b55 100644
--- a/typedsync/value.go
+++ b/typedsync/value.go
@@ -8,11 +8,15 @@ import (
"sync"
)
-// Value is a typed equivalent of sync/atomic.Value.
+// Value is a type-safe equivalent of the standard library's
+// sync/atomic.Value.
//
-// It is not actually a wrapper around sync/atomic.Value for
-// allocation-performance reasons.
+// See the [sync/atomic.Value documentation] for full details.
+//
+// [sync/atomic.Value documentation]: https://pkg.go.dev/sync/atomic#Value
type Value[T comparable] struct {
+ // It is not actually a wrapper around sync/atomic.Value for
+ // allocation-performance reasons.
mu sync.Mutex
ok bool
val T