mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 10:37:46 +00:00
64d7f1e436
Some source code wasn't part of `FMT_PATHS` so wasn't checked for correct formatting. This change includes all this source code and excludes cgo/testdata because it contains files that can't be parsed.
40 lines
857 B
Go
40 lines
857 B
Go
//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
|
|
}
|