go/src/sync
Mateusz Poliwczak ee0d03fab6 sync: don't keep func alive after OnceFunc panics
This moves the f = nil assignment to the defer statement,
so that in case the functions panics, the f func is not
referenced anymore.

Change-Id: I3e53b90a10f21741e26602270822c8a75679f163
GitHub-Last-Rev: bda01100c6
GitHub-Pull-Request: golang/go#68636
Reviewed-on: https://go-review.googlesource.com/c/go/+/601240
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2025-02-26 12:52:02 -08:00
..
atomic sync/atomic: make intrinsics noescape except 64bits op on 32bits arch and unsafe.Pointer 2024-11-15 17:11:46 +00:00
cond.go sync: include links to the Go memory model in package documentation 2024-06-07 21:14:51 +00:00
cond_test.go sync: fix TestCondSignalStealing flake 2023-03-22 18:52:42 +00:00
example_pool_test.go
example_test.go sync: add examples for OnceValue and OnceValues 2024-04-23 17:45:47 +00:00
export_test.go all: make struct comments match struct names 2024-07-11 17:23:45 +00:00
hashtriemap.go sync: make HashTrieMap[any, any] the default implementation of Map 2024-11-18 20:35:42 +00:00
map.go sync: make HashTrieMap[any, any] the default implementation of Map 2024-11-18 20:35:42 +00:00
map_bench_test.go sync: add HashTrieMap to Map tests and benchmarks 2024-11-18 20:35:37 +00:00
map_reference_test.go sync: add HashTrieMap to Map tests and benchmarks 2024-11-18 20:35:37 +00:00
map_test.go sync: use runtime.AddCleanup instead of runtime.SetFinalizer 2025-02-14 07:29:34 -08:00
mutex.go internal/sync: move sync.Mutex implementation into new package 2024-11-18 19:57:35 +00:00
mutex_test.go all: use testenv.Executable instead of os.Executable and os.Args[0] 2025-02-24 11:03:10 -08:00
once.go sync: add explicit noCopy fields to Map, Mutex, and Once 2024-11-18 18:52:54 +00:00
once_test.go
oncefunc.go sync: don't keep func alive after OnceFunc panics 2025-02-26 12:52:02 -08:00
oncefunc_test.go sync: don't keep func alive after OnceFunc panics 2025-02-26 12:52:02 -08:00
pool.go sync: include links to the Go memory model in package documentation 2024-06-07 21:14:51 +00:00
pool_test.go sync: use runtime.AddCleanup instead of runtime.SetFinalizer 2025-02-14 07:29:34 -08:00
poolqueue.go sync: simplify the code with atomic.Pointer 2024-02-26 18:12:29 +00:00
runtime.go internal/synctest: new package for testing concurrent code 2024-11-19 19:40:40 +00:00
runtime2.go
runtime2_lockrank.go
runtime_sema_test.go
rwmutex.go sync: document RWMutex locks cannot be upgraded / downgraded 2024-12-04 02:44:30 +00:00
rwmutex_test.go
waitgroup.go internal/synctest: new package for testing concurrent code 2024-11-19 19:40:40 +00:00
waitgroup_test.go