aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2025-02-19 17:28:45 +0000
committerGopher Robot <gobot@golang.org>2025-02-26 12:04:21 -0800
commit0bfde51e0d98097fed74e7a3e86e96da259325e1 (patch)
tree9781813188372e26738eba6923dd01d2f1dd3fd3
parent45a52718e31d6c268aaef8346d73c8fb12fca56c (diff)
downloadgo-0bfde51e0d98097fed74e7a3e86e96da259325e1.tar.xz
[release-branch.go1.24] runtime: document that cleanups can run concurrently with each other
For #71825. Fixes #71955. Change-Id: I25af19eb72d75f13cf661fc47ee5717782785326 Reviewed-on: https://go-review.googlesource.com/c/go/+/652637 Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Keith Randall <khr@google.com>
-rw-r--r--src/runtime/mcleanup.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/runtime/mcleanup.go b/src/runtime/mcleanup.go
index 972532d475..d41a4971b5 100644
--- a/src/runtime/mcleanup.go
+++ b/src/runtime/mcleanup.go
@@ -30,8 +30,10 @@ import (
// unreachable at the same time, their cleanups all become eligible to run
// and can run in any order. This is true even if the objects form a cycle.
//
-// A single goroutine runs all cleanup calls for a program, sequentially. If a
-// cleanup function must run for a long time, it should create a new goroutine.
+// Cleanups run concurrently with any user-created goroutines.
+// Cleanups may also run concurrently with one another (unlike finalizers).
+// If a cleanup function must run for a long time, it should create a new goroutine
+// to avoid blocking the execution of other cleanups.
//
// If ptr has both a cleanup and a finalizer, the cleanup will only run once
// it has been finalized and becomes unreachable without an associated finalizer.