runtime: remove the asyncScheduler constant

There is no reason to specialize this per chip as it is only ever used
for JavaScript. Not only that, it is causing confusion and is yet
another quirk to learn when porting the runtime to a new
microcontroller.
This commit is contained in:
Ayke van Laethem
2021-05-08 20:05:34 +02:00
committed by Ron Evans
parent 25b045d0a7
commit 8cd2a462b9
25 changed files with 8 additions and 52 deletions
+7 -1
View File
@@ -20,6 +20,10 @@ import (
const schedulerDebug = false
// On JavaScript, we can't do a blocking sleep. Instead we have to return and
// queue a new scheduler invocation using setTimeout.
const asyncScheduler = GOOS == "js"
var schedulerDone bool
// Queues used by the scheduler.
@@ -138,6 +142,7 @@ func scheduler() {
if t == nil {
if sleepQueue == nil {
if asyncScheduler {
// JavaScript is treated specially, see below.
return
}
waitForEvents()
@@ -154,7 +159,8 @@ func scheduler() {
if asyncScheduler {
// The sleepTicks function above only sets a timeout at which
// point the scheduler will be called again. It does not really
// sleep.
// sleep. So instead of sleeping, we return and expect to be
// called again.
break
}
continue