Skip to content

Commit 1f70fa3

Browse files
internal/fmtsort: makeChans pin pointer
Complete TODO. For #49431 Change-Id: Ifc79741ad44cd9631be49d4674db0ee52bbf6486
1 parent 561a507 commit 1f70fa3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/internal/fmtsort/sort_test.go

+4-2
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"
@@ -194,8 +195,9 @@ var (
194195

195196
func makeChans() []chan int {
196197
cs := []chan int{make(chan int), make(chan int), make(chan int)}
197-
// Order channels by address. See issue #49431.
198-
// TODO: pin these pointers once pinning is available (#46787).
198+
var pin runtime.Pinner
199+
pin.Pin(&cs)
200+
defer pin.Unpin()
199201
sort.Slice(cs, func(i, j int) bool {
200202
return uintptr(reflect.ValueOf(cs[i]).UnsafePointer()) < uintptr(reflect.ValueOf(cs[j]).UnsafePointer())
201203
})

0 commit comments

Comments
 (0)