mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 05:23:40 +00:00
runtime: fix sleep duration for long sleeps
Long sleep durations weren't implemented correctly, by simply casting to a smaller number of bits. What we want is a saturating downcast, which is what I've used here instead. This should fix https://github.com/tinygo-org/tinygo/issues/3356.
This commit is contained in:
committed by
Ron Evans
parent
faf455283d
commit
8872d5ebfc
@@ -266,6 +266,9 @@ func nanosecondsToTicks(ns int64) timeUnit {
|
||||
func sleepTicks(d timeUnit) {
|
||||
for d != 0 {
|
||||
ticks := uint32(d)
|
||||
if d > 0xffff_ffff {
|
||||
ticks = 0xffff_ffff
|
||||
}
|
||||
if !timerSleep(ticks) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user