mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 13:03:39 +00:00
c096f35224
This change fixes the edge case where a negative sleep time is provided. When this happens, the call now returns immediately (as specified by the docs for time.Sleep).
31 lines
647 B
Go
31 lines
647 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()
|
|
postinit()
|
|
callMain()
|
|
}
|
|
|
|
const hasScheduler = false
|