]> Cypherpunks repositories - gostls13.git/commitdiff
unique: clarify concurrent use of Make and Handle.Value
authorMichael Anthony Knyszek <mknyszek@google.com>
Thu, 26 Sep 2024 19:44:00 +0000 (19:44 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 26 Sep 2024 20:13:15 +0000 (20:13 +0000)
Fixes #69637.

Change-Id: Ie612b4df50f42f2786b22fb7a756949530f9178e
Reviewed-on: https://go-review.googlesource.com/c/go/+/616235
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/unique/handle.go

index 6912e2a2dac745476f814794ed0bd2b8ad6c0ef8..6ff37dc610b888d391ae64f9984910ee85d75314 100644 (file)
@@ -25,12 +25,14 @@ type Handle[T comparable] struct {
 }
 
 // Value returns a shallow copy of the T value that produced the Handle.
+// Value is safe for concurrent use by multiple goroutines.
 func (h Handle[T]) Value() T {
        return *h.value
 }
 
 // Make returns a globally unique handle for a value of type T. Handles
 // are equal if and only if the values used to produce them are equal.
+// Make is safe for concurrent use by multiple goroutines.
 func Make[T comparable](value T) Handle[T] {
        // Find the map for type T.
        typ := abi.TypeFor[T]()