Complete TODO.
For #49431
Change-Id: I1399205e430ebd83182c3e0c4becf1fde32d433e
GitHub-Last-Rev:
02cdea740bccbe0993c53fecdd32608f08861e59
GitHub-Pull-Request: golang/go#62673
Reviewed-on: https://go-review.googlesource.com/c/go/+/528796
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Commit-Queue: Keith Randall <khr@golang.org>
Run-TryBot: qiulaidongfeng <
2645477756@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
"internal/fmtsort"
"math"
"reflect"
+ "runtime"
"sort"
"strings"
"testing"
var (
ints [3]int
chans = makeChans()
+ pin runtime.Pinner
)
func makeChans() []chan int {
cs := []chan int{make(chan int), make(chan int), make(chan int)}
// Order channels by address. See issue #49431.
- // TODO: pin these pointers once pinning is available (#46787).
+ for i := range cs {
+ pin.Pin(reflect.ValueOf(cs[i]).UnsafePointer())
+ }
sort.Slice(cs, func(i, j int) bool {
return uintptr(reflect.ValueOf(cs[i]).UnsafePointer()) < uintptr(reflect.ValueOf(cs[j]).UnsafePointer())
})