]> Cypherpunks repositories - gostls13.git/commit
runtime: implement AddCleanup
authorCarlos Amedee <carlos@golang.org>
Wed, 13 Nov 2024 20:25:41 +0000 (15:25 -0500)
committerCarlos Amedee <carlos@golang.org>
Sat, 16 Nov 2024 03:26:04 +0000 (03:26 +0000)
commit0531768b30273ec8c4fe8e234ca96c471bcf5dc3
tree95974ad9eb724bc6f3109066fa5967e304a33cb9
parent8ac0a7c512e7c1bf6fb94feb09b2f878d8eb14a1
runtime: implement AddCleanup

This change introduces AddCleanup to the runtime package. AddCleanup attaches
a cleanup function to an pointer to an object.

The Stop method on Cleanups will be implemented in a followup CL.

AddCleanup is intended to be an incremental improvement over
SetFinalizer and will result in SetFinalizer being deprecated.

For #67535

Change-Id: I99645152e3fdcee85fcf42a4f312c6917e8aecb1
Reviewed-on: https://go-review.googlesource.com/c/go/+/627695
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
api/next/67535.txt [new file with mode: 0644]
doc/next/6-stdlib/99-minor/runtime/67535.md [new file with mode: 0644]
src/runtime/mcleanup.go [new file with mode: 0644]
src/runtime/mcleanup_test.go [new file with mode: 0644]
src/runtime/mfinal.go
src/runtime/mgc.go
src/runtime/mgcmark.go
src/runtime/mheap.go