File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
neovim/msgpack_rpc/event_loop Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -108,8 +108,7 @@ def _stop(self):
108
108
self ._loop .stop ()
109
109
110
110
def _interrupt (self ):
111
- self ._loop .call_soon_threadsafe (asyncio .async ,
112
- lambda : self ._loop .stop ())
111
+ self ._loop .call_soon_threadsafe (lambda : self .stop ())
113
112
114
113
def _setup_signals (self , signals ):
115
114
self ._signals = list (signals )
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ class UvEventLoop(BaseEventLoop):
12
12
13
13
def _init (self ):
14
14
self ._loop = pyuv .Loop ()
15
- self ._async = pyuv .Async (self ._loop , lambda h : self ._on_interrupt )
15
+ self ._async = pyuv .Async (self ._loop , lambda h : self .stop () )
16
16
self ._connection_error = None
17
17
self ._error_stream = None
18
18
Original file line number Diff line number Diff line change 2
2
from random import random
3
3
from nose .tools import with_setup , eq_ as eq
4
4
from common import vim , cleanup
5
- from threading import Thread
5
+ from threading import Thread , Timer
6
6
7
7
8
8
@with_setup (setup = cleanup )
@@ -22,3 +22,12 @@ def produce(i):
22
22
custom_messages .append (vim .session .next_message ())
23
23
24
24
eq (len (custom_messages ), 50 )
25
+
26
+
27
+ @with_setup (setup = cleanup )
28
+ def test_interrupt_from_another_thread ():
29
+ timer = Timer (0.5 , lambda : vim .session .post ('timeout' ))
30
+ timer .start ()
31
+ msg = vim .session .next_message ()
32
+ eq (msg [0 ], 'notification' )
33
+ eq (msg [1 ], 'timeout' )
You can’t perform that action at this time.
0 commit comments