We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5fe2035 commit 02cdea7Copy full SHA for 02cdea7
src/internal/fmtsort/sort_test.go
@@ -9,6 +9,7 @@ import (
9
"internal/fmtsort"
10
"math"
11
"reflect"
12
+ "runtime"
13
"sort"
14
"strings"
15
"testing"
@@ -190,12 +191,15 @@ func sprintKey(key reflect.Value) string {
190
191
var (
192
ints [3]int
193
chans = makeChans()
194
+ pin runtime.Pinner
195
)
196
197
func makeChans() []chan int {
198
cs := []chan int{make(chan int), make(chan int), make(chan int)}
199
// Order channels by address. See issue #49431.
- // TODO: pin these pointers once pinning is available (#46787).
200
+ for i := range cs {
201
+ pin.Pin(reflect.ValueOf(cs[i]).UnsafePointer())
202
+ }
203
sort.Slice(cs, func(i, j int) bool {
204
return uintptr(reflect.ValueOf(cs[i]).UnsafePointer()) < uintptr(reflect.ValueOf(cs[j]).UnsafePointer())
205
})
0 commit comments