Ensure session close work when triggered not in main thread
Signal is not working when the running program is not in python main thread. ensure session close can work in above case.
@@ -810,8 +810,11 @@ class Session(object):
Note that closing will ignore SIGINT and SIGTERM signal and recover later.
"""
+ if threading.currentThread() is threading.main_thread():
with SignalIgnore([signal.SIGINT, signal.SIGTERM]):
self._close()
+ else:
+ self._close()
def _close(self):
if self._closed:
