1
0
mirror of https://github.com/golang/go synced 2024-10-01 01:18:32 -06:00
go/internal/memoize
Heschi Kreinick 61fa4dffed internal/memoize: fix race on read of handle.function
Late into CL 206879 I started nulling out a handle's function when the
handle finished running. That invalidated a previous assumption that the
field was immutable. Fix the assumption, and since the case of having
multiple computations in flight is at least a little bit possible, try
harder to avoid duplicate work.

Fixes golang/go#35995.

Change-Id: Ib5e3640f931f95e35748f28f5a82cf75585b305d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/210077
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-05 18:38:34 +00:00
..
memoize_test.go internal/memoize: changes to only one handle per key 2019-09-17 14:40:27 +00:00
memoize.go internal/memoize: fix race on read of handle.function 2019-12-05 18:38:34 +00:00
nocopy.go internal/memoize: a new library to memoize functions 2019-06-10 23:17:49 +00:00