File tree Expand file tree Collapse file tree 2 files changed +10
-16
lines changed Expand file tree Collapse file tree 2 files changed +10
-16
lines changed Original file line number Diff line number Diff line change @@ -119,19 +119,17 @@ func ticks() timeUnit {
119
119
}
120
120
121
121
func sleepTicks (duration timeUnit ) {
122
- if duration >= 0 {
123
- curr := ticks ()
124
- last := curr + duration // 64-bit overflow unlikely
125
- for curr < last {
126
- cycles := timeUnit ((last - curr ) / pitCyclesPerMicro )
127
- if cycles > 0xFFFFFFFF {
128
- cycles = 0xFFFFFFFF
129
- }
130
- if ! timerSleep (uint32 (cycles )) {
131
- return // return early due to interrupt
132
- }
133
- curr = ticks ()
122
+ curr := ticks ()
123
+ last := curr + duration // 64-bit overflow unlikely
124
+ for curr < last {
125
+ cycles := timeUnit ((last - curr ) / pitCyclesPerMicro )
126
+ if cycles > 0xFFFFFFFF {
127
+ cycles = 0xFFFFFFFF
134
128
}
129
+ if ! timerSleep (uint32 (cycles )) {
130
+ return // return early due to interrupt
131
+ }
132
+ curr = ticks ()
135
133
}
136
134
}
137
135
Original file line number Diff line number Diff line change @@ -31,10 +31,6 @@ func nanosecondsToTicks(ns int64) timeUnit {
31
31
}
32
32
33
33
func sleepTicks (d timeUnit ) {
34
- if d <= 0 {
35
- return
36
- }
37
-
38
34
if hasScheduler {
39
35
// With scheduler, sleepTicks may return early if an interrupt or
40
36
// event fires - so scheduler can schedule any go routines now
You can’t perform that action at this time.
0 commit comments