File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
neovim/msgpack_rpc/event_loop Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1
1
"""Common code for event loop implementations."""
2
2
import logging
3
3
import signal
4
+ import threading
4
5
5
6
6
7
logger = logging .getLogger (__name__ )
11
12
# which exits the program. To be able to restore the python interpreter to it's
12
13
# default state, we keep a reference to the default handler
13
14
default_int_handler = signal .getsignal (signal .SIGINT )
15
+ main_thread = threading .current_thread ()
14
16
15
17
16
18
class BaseEventLoop (object ):
@@ -131,12 +133,14 @@ def run(self, data_cb):
131
133
self ._error = None
132
134
raise err
133
135
self ._on_data = data_cb
134
- self ._setup_signals ([signal .SIGINT , signal .SIGTERM ])
136
+ if threading .current_thread () == main_thread :
137
+ self ._setup_signals ([signal .SIGINT , signal .SIGTERM ])
135
138
debug ('Entering event loop' )
136
139
self ._run ()
137
140
debug ('Exited event loop' )
138
- self ._teardown_signals ()
139
- signal .signal (signal .SIGINT , default_int_handler )
141
+ if threading .current_thread () == main_thread :
142
+ self ._teardown_signals ()
143
+ signal .signal (signal .SIGINT , default_int_handler )
140
144
self ._on_data = None
141
145
142
146
def stop (self ):
You can’t perform that action at this time.
0 commit comments