mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-27 01:48:17 +00:00
trezor/loop: add loop.close()
This commit is contained in:
parent
9ea975d37d
commit
04acab723a
@ -451,7 +451,8 @@ class ConfirmState:
|
||||
def kill(self) -> None:
|
||||
if self.task is not None:
|
||||
workflow.onclose(self.task)
|
||||
self.task.close()
|
||||
loop.close(self.task)
|
||||
self.task = None
|
||||
|
||||
async def confirm(self) -> None:
|
||||
from trezor.ui.confirm import HoldToConfirmDialog
|
||||
|
@ -65,6 +65,12 @@ def unpause(task):
|
||||
_paused[iface].remove(task)
|
||||
|
||||
|
||||
def close(task):
|
||||
unschedule(task)
|
||||
unpause(task)
|
||||
task.close()
|
||||
|
||||
|
||||
def run():
|
||||
'''
|
||||
Loop forever, stepping through scheduled tasks and awaiting I/O events
|
||||
@ -259,9 +265,7 @@ class wait(Syscall):
|
||||
def exit(self):
|
||||
for task in self.scheduled:
|
||||
if task not in self.finished:
|
||||
unpause(task)
|
||||
unschedule(task)
|
||||
task.close()
|
||||
close(task)
|
||||
|
||||
async def _wait(self, child):
|
||||
try:
|
||||
|
@ -227,7 +227,7 @@ class SesssionSupervisor:
|
||||
def close(self, sid):
|
||||
if sid in self.handling_tasks:
|
||||
task = self.handling_tasks.pop(sid)
|
||||
task.close()
|
||||
loop.close(task)
|
||||
|
||||
def newsid(self):
|
||||
while True:
|
||||
|
@ -26,7 +26,7 @@ def closedefault():
|
||||
global default
|
||||
|
||||
if default:
|
||||
default.close()
|
||||
loop.close(default)
|
||||
default = None
|
||||
log.debug(__name__, 'closedefault')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user