[Core] Show_webui segfault fix. (#8323)

This commit is contained in:
SangBin Cho
2020-05-06 09:45:07 -07:00
committed by GitHub
parent 04813c2ef5
commit e631827a9f
6 changed files with 35 additions and 3 deletions
+10 -1
View File
@@ -107,7 +107,8 @@ class AsyncMonitorState:
self.names_lock = threading.Lock()
self.sleep_time = 1.0
asyncio.ensure_future(self.monitor(), loop=loop)
self.monitor_loop_future = asyncio.ensure_future(
self.monitor(), loop=loop)
async def monitor(self):
while True:
@@ -131,3 +132,11 @@ class AsyncMonitorState:
with self.names_lock:
names = list(self.names.values())
return names
def kill(self):
"""Kill the monitor's loop
This should be called in order to clean an event loop
that this monitor is running.
"""
self.monitor_loop_future.cancel()