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):
12731273 line = sys .stdin .readline ()
12741274 if line .lower ().startswith (yes ) and no not in line .lower ():
12751275 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 )
12771279 return
12781280 else :
12791281 print (_ ("No answer for 5s:" ), end = ' ' )
@@ -1282,11 +1284,11 @@ def _confirm_exit(self):
12821284 # set it back to original SIGINT handler
12831285 # use IOLoop.add_callback because signal.signal must be called
12841286 # 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 )
12861288
12871289 def _signal_stop (self , sig , frame ):
12881290 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 )
12901292
12911293 def _signal_info (self , sig , frame ):
12921294 print (self .notebook_info ())
You can’t perform that action at this time.
0 commit comments