blob: 19dbee62448a54b983de7d93393318699c751e82 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
//go:build scheduler.none
// +build scheduler.none
package task
import "unsafe"
// There is only one goroutine so the task struct can be a global.
var mainTask Task
//go:linkname runtimePanic runtime.runtimePanic
func runtimePanic(str string)
func Pause() {
runtimePanic("scheduler is disabled")
}
func Current() *Task {
// Return a task struct, which is used for the recover builtin for example.
return &mainTask
}
//go:noinline
func start(fn uintptr, args unsafe.Pointer, stackSize uintptr) {
// The compiler will error if this is reachable.
runtimePanic("scheduler is disabled")
}
type state struct{}
func (t *Task) Resume() {
runtimePanic("scheduler is disabled")
}
// OnSystemStack returns whether the caller is running on the system stack.
func OnSystemStack() bool {
// This scheduler does not do any stack switching.
return true
}
|