From b7e4d2067c58a326426eddeece76634db0bb1e43 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Thu, 26 Sep 2024 19:44:00 +0000 Subject: [PATCH] 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 --- src/unique/handle.go | 2 ++ 1 file changed, 2 insertions(+) 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]() -- 2.48.1