We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5fe2035 commit 9f52aaaCopy full SHA for 9f52aaa
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"
@@ -194,8 +195,11 @@ var (
194
195
196
func makeChans() []chan int {
197
cs := []chan int{make(chan int), make(chan int), make(chan int)}
- // Order channels by address. See issue #49431.
198
- // TODO: pin these pointers once pinning is available (#46787).
+ var pin runtime.Pinner
199
+ for i := range cs {
200
+ pin.Pin(&cs[i])
201
+ }
202
+ defer pin.Unpin()
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