all: rewrite sleep function

time.Sleep now compiles on all systems, so lets use that.
Additionally, do a few improvements in time unit handling for the
scheduler. This should lead to somewhat longer sleep durations without
wrapping (on some platforms).

Some examples got smaller, some got bigger. In particular, code using
the scheduler got bigger and the blinky1 example got smaller (especially
on Arduino: 380 -> 314 bytes).
This commit is contained in:
Ayke van Laethem
2018-09-15 01:08:31 +02:00
parent 1ac67cf8de
commit 2a20c0c7f0
12 changed files with 75 additions and 72 deletions
-7
View File
@@ -39,13 +39,6 @@ func main() int {
}
}
func Sleep(d Duration) {
// This function is treated specially by the compiler: when goroutines are
// used, it is transformed into a llvm.coro.suspend() call.
// When goroutines are not used this function behaves as normal.
sleep(d)
}
func GOMAXPROCS(n int) int {
// Note: setting GOMAXPROCS is ignored.
return 1