mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-27 01:48:17 +00:00
Revert "trezor/loop: optimization"
This reverts commit cfa1705a88
.
In MicroPython, list.clear() does not memset the backing buffer, preventing the
paused tasks from being garbage collected.
This commit is contained in:
parent
cfa1705a88
commit
c254758c83
@ -53,7 +53,7 @@ def unschedule(task):
|
|||||||
|
|
||||||
|
|
||||||
def pause(task, iface):
|
def pause(task, iface):
|
||||||
tasks = _paused.get(iface)
|
tasks = _paused.get(iface, None)
|
||||||
if tasks is None:
|
if tasks is None:
|
||||||
tasks = _paused[iface] = []
|
tasks = _paused[iface] = []
|
||||||
tasks.append(task)
|
tasks.append(task)
|
||||||
@ -94,11 +94,9 @@ def run():
|
|||||||
|
|
||||||
if io.poll(_paused, msg_entry, delay):
|
if io.poll(_paused, msg_entry, delay):
|
||||||
# message received, run tasks paused on the interface
|
# message received, run tasks paused on the interface
|
||||||
msg_tasks = _paused.get(msg_entry[0])
|
msg_tasks = _paused.pop(msg_entry[0], ())
|
||||||
if msg_tasks is not None:
|
for task in msg_tasks:
|
||||||
for task in msg_tasks:
|
_step(task, msg_entry[1])
|
||||||
_step(task, msg_entry[1])
|
|
||||||
msg_tasks.clear()
|
|
||||||
else:
|
else:
|
||||||
# timeout occurred, run the first scheduled task
|
# timeout occurred, run the first scheduled task
|
||||||
if _queue:
|
if _queue:
|
||||||
|
Loading…
Reference in New Issue
Block a user