-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deal with removal of forEachG linkname availability
This is arguably a breaking change, but not removing this prevents the package from building at all on go1.23, so given the universe we are in this is being treated as a bugfix.
- Loading branch information
Showing
3 changed files
with
33 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright ©2023 Dan Kortschak. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build go1.21 && !go1.23 | ||
// +build go1.21,!go1.23 | ||
|
||
package goroutine | ||
|
||
import "unsafe" | ||
|
||
// Link is a goroutine parent-child relationship. | ||
// | ||
// Only available for go1.21 and go1.22. | ||
type Link struct { | ||
Parent, Child int64 | ||
} | ||
|
||
// All returns all the known goroutine parent-child relationships. | ||
// | ||
// Only available for go1.21 and go1.22. | ||
func All() []Link { | ||
var s []Link | ||
forEachG(func(g unsafe.Pointer) { | ||
s = append(s, Link{Parent: idOf(g, parentGoidoff), Child: idOf(g, goidoff)}) | ||
}) | ||
return s | ||
} | ||
|
||
//go:linkname forEachG runtime.forEachG | ||
//go:nosplit | ||
func forEachG(fn func(gp unsafe.Pointer)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters