mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-18 03:24:00 +00:00
runtime: remove unnecessary check for negative sleepTicks duration
This is now fixed for every target in the previous commit. Also see: https://github.com/tinygo-org/tinygo/pull/4239
This commit is contained in:
@@ -119,7 +119,6 @@ func ticks() timeUnit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func sleepTicks(duration timeUnit) {
|
func sleepTicks(duration timeUnit) {
|
||||||
if duration >= 0 {
|
|
||||||
curr := ticks()
|
curr := ticks()
|
||||||
last := curr + duration // 64-bit overflow unlikely
|
last := curr + duration // 64-bit overflow unlikely
|
||||||
for curr < last {
|
for curr < last {
|
||||||
@@ -133,7 +132,6 @@ func sleepTicks(duration timeUnit) {
|
|||||||
curr = ticks()
|
curr = ticks()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func timerSleep(cycles uint32) bool {
|
func timerSleep(cycles uint32) bool {
|
||||||
pitActive.Set(1)
|
pitActive.Set(1)
|
||||||
|
|||||||
@@ -31,10 +31,6 @@ func nanosecondsToTicks(ns int64) timeUnit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func sleepTicks(d timeUnit) {
|
func sleepTicks(d timeUnit) {
|
||||||
if d <= 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if hasScheduler {
|
if hasScheduler {
|
||||||
// With scheduler, sleepTicks may return early if an interrupt or
|
// With scheduler, sleepTicks may return early if an interrupt or
|
||||||
// event fires - so scheduler can schedule any go routines now
|
// event fires - so scheduler can schedule any go routines now
|
||||||
|
|||||||
Reference in New Issue
Block a user