File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,16 @@ def __init__(self, **kwargs):
1515 self .pydev_do_not_trace = True
1616 self .is_pydev_daemon_thread = True
1717
18- def run (self ):
18+ def run (self ):
1919 self .io_loop .make_current ()
20- self .io_loop .start ()
21- self .io_loop .close (all_fds = True )
20+ try :
21+ self .io_loop .start ()
22+ finally :
23+ self .io_loop .close ()
24+
25+ def stop (self ):
26+ """Stop the thread.
27+
28+ This method is threadsafe.
29+ """
30+ self .io_loop .add_callback (self .io_loop .stop )
Original file line number Diff line number Diff line change @@ -346,6 +346,10 @@ def close(self):
346346 self .log .debug ("Closing iopub channel" )
347347 self .iopub_thread .stop ()
348348 self .iopub_thread .close ()
349+ if self .control_thread :
350+ self .log .debug ("Closing control thread" )
351+ self .control_thread .stop ()
352+ self .control_thread .join ()
349353
350354 if self .debugpy_socket and not self .debugpy_socket .closed :
351355 self .debugpy_socket .close ()
@@ -487,7 +491,7 @@ def init_kernel(self):
487491 control_stream = control_stream ,
488492 debugpy_stream = debugpy_stream ,
489493 debug_shell_socket = self .debug_shell_socket ,
490- shell_stream = shell_stream ,
494+ shell_stream = shell_stream ,
491495 control_thread = self .control_thread ,
492496 iopub_thread = self .iopub_thread ,
493497 iopub_socket = self .iopub_socket ,
You can’t perform that action at this time.
0 commit comments