From: Michael Anthony Knyszek Date: Thu, 26 Sep 2024 19:44:00 +0000 (+0000) Subject: unique: clarify concurrent use of Make and Handle.Value X-Git-Tag: go1.24rc1~820 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b7e4d2067c58a326426eddeece76634db0bb1e43;p=gostls13.git unique: clarify concurrent use of Make and Handle.Value Fixes #69637. Change-Id: Ie612b4df50f42f2786b22fb7a756949530f9178e Reviewed-on: https://go-review.googlesource.com/c/go/+/616235 LUCI-TryBot-Result: Go LUCI Auto-Submit: Michael Knyszek Reviewed-by: Ian Lance Taylor --- diff --git a/src/unique/handle.go b/src/unique/handle.go index 6912e2a2da..6ff37dc610 100644 --- a/src/unique/handle.go +++ b/src/unique/handle.go @@ -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]()