Debian Codegraph @

src/cmd/link/testdata/linkname/coro.go

raw
1 // Copyright 2024 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Linkname coroswitch is not allowed, even if iter.Pull
6 // is instantiated in the same package.
7
8 package main
9
10 import (
11 "iter"
12 "unsafe"
13 )
14
15 func seq(yield func(int) bool) {
16 yield(123)
17 }
18
19 func main() {
20 next, stop := iter.Pull(seq)
21 next()
22 stop()
23 coroswitch(nil)
24 }
25
26 //go:linkname coroswitch runtime.coroswitch
27 func coroswitch(unsafe.Pointer)