kopia lustrzana https://github.com/micropython/micropython-lib
uasyncio.core: Make I/O scheduling fair wrt to computational scheduling.
If there is a coroutine to run immediately (with wait delay <= 0), uasyncio.core never called .wait() method, which is required to process I/O events (and schedule coroutines waiting for them). So now, call .wait(0) even if there's a coroutine to run immediately.pull/183/merge
rodzic
65605e3de8
commit
eef054d98a
|
@ -59,9 +59,12 @@ class EventLoop:
|
||||||
t = self.q.peektime()
|
t = self.q.peektime()
|
||||||
tnow = self.time()
|
tnow = self.time()
|
||||||
delay = time.ticks_diff(t, tnow)
|
delay = time.ticks_diff(t, tnow)
|
||||||
if delay <= 0:
|
if delay < 0:
|
||||||
break
|
delay = 0
|
||||||
|
# Always call wait(), to give a chance to I/O scheduling
|
||||||
self.wait(delay)
|
self.wait(delay)
|
||||||
|
if delay == 0:
|
||||||
|
break
|
||||||
|
|
||||||
self.q.pop(cur_task)
|
self.q.pop(cur_task)
|
||||||
t = cur_task[0]
|
t = cur_task[0]
|
||||||
|
|
Ładowanie…
Reference in New Issue