Skip to content

Commit 02cdea7

Browse files
internal/fmtsort: makeChans pin pointer
Complete TODO. For #49431 Change-Id: Ifc79741ad44cd9631be49d4674db0ee52bbf6486
1 parent 5fe2035 commit 02cdea7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/internal/fmtsort/sort_test.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"internal/fmtsort"
1010
"math"
1111
"reflect"
12+
"runtime"
1213
"sort"
1314
"strings"
1415
"testing"
@@ -190,12 +191,15 @@ func sprintKey(key reflect.Value) string {
190191
var (
191192
ints [3]int
192193
chans = makeChans()
194+
pin runtime.Pinner
193195
)
194196

195197
func makeChans() []chan int {
196198
cs := []chan int{make(chan int), make(chan int), make(chan int)}
197199
// Order channels by address. See issue #49431.
198-
// TODO: pin these pointers once pinning is available (#46787).
200+
for i := range cs {
201+
pin.Pin(reflect.ValueOf(cs[i]).UnsafePointer())
202+
}
199203
sort.Slice(cs, func(i, j int) bool {
200204
return uintptr(reflect.ValueOf(cs[i]).UnsafePointer()) < uintptr(reflect.ValueOf(cs[j]).UnsafePointer())
201205
})

0 commit comments

Comments
 (0)