]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.24] runtime: document that cleanups can run concurrently with...
authorMichael Anthony Knyszek <mknyszek@google.com>
Wed, 19 Feb 2025 17:28:45 +0000 (17:28 +0000)
committerGopher Robot <gobot@golang.org>
Wed, 26 Feb 2025 20:04:21 +0000 (12:04 -0800)
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>
src/runtime/mcleanup.go

index 972532d475c0b40209b47d615a38d30c64f1fef7..d41a4971b525cf2d0e9e5d92d7b9acc3b1763b01 100644 (file)
@@ -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.