File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -1273,7 +1273,9 @@ def _confirm_exit(self):
1273
1273
line = sys .stdin .readline ()
1274
1274
if line .lower ().startswith (yes ) and no not in line .lower ():
1275
1275
self .log .critical (_ ("Shutdown confirmed" ))
1276
- ioloop .IOLoop .current ().stop ()
1276
+ # schedule stop on the main thread,
1277
+ # since this might be called from a signal handler
1278
+ self .io_loop .add_callback_from_signal (self .io_loop .stop )
1277
1279
return
1278
1280
else :
1279
1281
print (_ ("No answer for 5s:" ), end = ' ' )
@@ -1282,11 +1284,11 @@ def _confirm_exit(self):
1282
1284
# set it back to original SIGINT handler
1283
1285
# use IOLoop.add_callback because signal.signal must be called
1284
1286
# from main thread
1285
- ioloop . IOLoop . current (). add_callback (self ._restore_sigint_handler )
1287
+ self . io_loop . add_callback_from_signal (self ._restore_sigint_handler )
1286
1288
1287
1289
def _signal_stop (self , sig , frame ):
1288
1290
self .log .critical (_ ("received signal %s, stopping" ), sig )
1289
- ioloop . IOLoop . current (). stop ( )
1291
+ self . io_loop . add_callback_from_signal ( self . io_loop . stop )
1290
1292
1291
1293
def _signal_info (self , sig , frame ):
1292
1294
print (self .notebook_info ())
You can’t perform that action at this time.
0 commit comments