Skip to content

Commit 0bfde51

Browse files
mknyszekgopherbot
authored andcommitted
[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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Michael Knyszek <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent 45a5271 commit 0bfde51

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/runtime/mcleanup.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ import (
3030
// unreachable at the same time, their cleanups all become eligible to run
3131
// and can run in any order. This is true even if the objects form a cycle.
3232
//
33-
// A single goroutine runs all cleanup calls for a program, sequentially. If a
34-
// cleanup function must run for a long time, it should create a new goroutine.
33+
// Cleanups run concurrently with any user-created goroutines.
34+
// Cleanups may also run concurrently with one another (unlike finalizers).
35+
// If a cleanup function must run for a long time, it should create a new goroutine
36+
// to avoid blocking the execution of other cleanups.
3537
//
3638
// If ptr has both a cleanup and a finalizer, the cleanup will only run once
3739
// it has been finalized and becomes unreachable without an associated finalizer.

0 commit comments

Comments
 (0)