From dfc86e922cd033155339c22aff64e109f6c8cc89 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Thu, 4 Apr 2024 04:50:13 +0000 Subject: internal/weak: add package implementing weak pointers This change adds the internal/weak package, which exposes GC-supported weak pointers to the standard library. This is for the upcoming weak package, but may be useful for other future constructs. For #62483. Change-Id: I4aa8fa9400110ad5ea022a43c094051699ccab9d Reviewed-on: https://go-review.googlesource.com/c/go/+/576297 Auto-Submit: Michael Knyszek Reviewed-by: David Chase LUCI-TryBot-Result: Go LUCI --- src/runtime/proc.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/runtime/proc.go') diff --git a/src/runtime/proc.go b/src/runtime/proc.go index a029a23f7d..8f5787dbbb 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -6937,6 +6937,18 @@ func sync_atomic_runtime_procUnpin() { procUnpin() } +//go:linkname internal_weak_runtime_procPin internal/weak.runtime_procPin +//go:nosplit +func internal_weak_runtime_procPin() int { + return procPin() +} + +//go:linkname internal_weak_runtime_procUnpin internal/weak.runtime_procUnpin +//go:nosplit +func internal_weak_runtime_procUnpin() { + procUnpin() +} + // Active spinning for sync.Mutex. // //go:linkname sync_runtime_canSpin sync.runtime_canSpin -- cgit v1.3