mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 04:23:41 +00:00
runtime: don't call sleepTicks with a negative duration
There are rare cases where this can happen, see for example https://github.com/tinygo-org/tinygo/issues/4568
This commit is contained in:
@@ -41,9 +41,9 @@ func TestBinarySize(t *testing.T) {
|
||||
// This is a small number of very diverse targets that we want to test.
|
||||
tests := []sizeTest{
|
||||
// microcontrollers
|
||||
{"hifive1b", "examples/echo", 4568, 280, 0, 2268},
|
||||
{"microbit", "examples/serial", 2868, 388, 8, 2272},
|
||||
{"wioterminal", "examples/pininterrupt", 6104, 1484, 116, 6832},
|
||||
{"hifive1b", "examples/echo", 4580, 280, 0, 2268},
|
||||
{"microbit", "examples/serial", 2888, 388, 8, 2272},
|
||||
{"wioterminal", "examples/pininterrupt", 6124, 1484, 116, 6832},
|
||||
|
||||
// TODO: also check wasm. Right now this is difficult, because
|
||||
// wasm binaries are run through wasm-opt and therefore the
|
||||
|
||||
@@ -230,13 +230,15 @@ func scheduler(returnAtDeadlock bool) {
|
||||
println("--- timer waiting:", tim, tim.whenTicks())
|
||||
}
|
||||
}
|
||||
sleepTicks(timeLeft)
|
||||
if asyncScheduler {
|
||||
// The sleepTicks function above only sets a timeout at which
|
||||
// point the scheduler will be called again. It does not really
|
||||
// sleep. So instead of sleeping, we return and expect to be
|
||||
// called again.
|
||||
break
|
||||
if timeLeft > 0 {
|
||||
sleepTicks(timeLeft)
|
||||
if asyncScheduler {
|
||||
// The sleepTicks function above only sets a timeout at
|
||||
// which point the scheduler will be called again. It does
|
||||
// not really sleep. So instead of sleeping, we return and
|
||||
// expect to be called again.
|
||||
break
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user