kopia lustrzana https://github.com/micropython/micropython-lib
uasyncio.core: Store currently executed task as an attribute of event loop.
Currently executed task is a top-level coroutine scheduled in the event loop (note that sub-coroutines aren't scheduled in the event loop and are executed implicitly by yield from/await, driven by top-level coro).pull/234/merge
rodzic
d87573b113
commit
afa6192501
|
@ -19,6 +19,10 @@ class EventLoop:
|
||||||
|
|
||||||
def __init__(self, len=42):
|
def __init__(self, len=42):
|
||||||
self.q = utimeq.utimeq(len)
|
self.q = utimeq.utimeq(len)
|
||||||
|
# Current task being run. Task is a top-level coroutine scheduled
|
||||||
|
# in the event loop (sub-coroutines executed transparently by
|
||||||
|
# yield from/await, event loop "doesn't see" them).
|
||||||
|
self.cur_task = None
|
||||||
|
|
||||||
def time(self):
|
def time(self):
|
||||||
return time.ticks_ms()
|
return time.ticks_ms()
|
||||||
|
@ -72,6 +76,7 @@ class EventLoop:
|
||||||
args = cur_task[2]
|
args = cur_task[2]
|
||||||
if __debug__ and DEBUG:
|
if __debug__ and DEBUG:
|
||||||
log.debug("Next coroutine to run: %s", (t, cb, args))
|
log.debug("Next coroutine to run: %s", (t, cb, args))
|
||||||
|
self.cur_task = cb
|
||||||
# __main__.mem_info()
|
# __main__.mem_info()
|
||||||
else:
|
else:
|
||||||
self.wait(-1)
|
self.wait(-1)
|
||||||
|
|
Ładowanie…
Reference in New Issue