mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 11:07:46 +00:00
fcd88356db
In the early days of TinyGo, the idea of `postinit` was to enable interrupts only after initializers have run. Which kind of makes sense... except that `time.Sleep` is allowed in init code and `time.Sleep` requires interrupts to be enabled. Therefore, interrupts must be enabled while initializers are being run. This commit simply moves the enabling of interrupts to a point right before running package initializers. It also removes `runtime.postinit`, which is not necessary anymore (and was only used on AVR).
30 lines
635 B
Go
30 lines
635 B
Go
//go:build scheduler.none
|
|
// +build scheduler.none
|
|
|
|
package runtime
|
|
|
|
//go:linkname sleep time.Sleep
|
|
func sleep(duration int64) {
|
|
if duration <= 0 {
|
|
return
|
|
}
|
|
|
|
sleepTicks(nanosecondsToTicks(duration))
|
|
}
|
|
|
|
// getSystemStackPointer returns the current stack pointer of the system stack.
|
|
// This is always the current stack pointer.
|
|
func getSystemStackPointer() uintptr {
|
|
return getCurrentStackPointer()
|
|
}
|
|
|
|
// run is called by the program entry point to execute the go program.
|
|
// With the "none" scheduler, init and the main function are invoked directly.
|
|
func run() {
|
|
initHeap()
|
|
initAll()
|
|
callMain()
|
|
}
|
|
|
|
const hasScheduler = false
|