mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 14:03:39 +00:00
runtime: move scheduler code around
This moves all scheduler code into a separate file that is only compiled
when there's a scheduler in use (the tasks or asyncify scheduler, which
are both cooperative). The main goal of this change is to make it easier
to add a new "scheduler" based on OS threads.
It also fixes a few subtle issues with `-gc=none`:
- Gosched() panicked. This is now fixed to just return immediately
(the only logical thing to do when there's only one goroutine).
- Timers aren't supported without a scheduler, but the relevant code
was still present and would happily add a timer to the queue. It
just never ran. So now it exits with a runtime error, similar to any
blocking operation.
This commit is contained in:
committed by
Ron Evans
parent
6593cf22fa
commit
d1fe02df23
+2
-4
@@ -183,8 +183,7 @@ func (ch *channel) resumeRX(ok bool) unsafe.Pointer {
|
||||
b.detach()
|
||||
}
|
||||
|
||||
// push task onto runqueue
|
||||
runqueue.Push(b.t)
|
||||
scheduleTask(b.t)
|
||||
|
||||
return dst
|
||||
}
|
||||
@@ -210,8 +209,7 @@ func (ch *channel) resumeTX() unsafe.Pointer {
|
||||
b.detach()
|
||||
}
|
||||
|
||||
// push task onto runqueue
|
||||
runqueue.Push(b.t)
|
||||
scheduleTask(b.t)
|
||||
|
||||
return src
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user